In a single script M-file, create anonymous function handles for each of the fol
ID: 3882656 • Letter: I
Question
In a single script M-file, create anonymous function handles for each of the following and generate a plot as indicated, using fplot. Note that you can use figure before each fplot command to open a new plot window. Place a title on the plots, naming them "f(x)" "g(x)" "h(x)". Upload one M-file & one PDF file. f(x) = x^2 sin(3x) - 2: 0 lessthanorequalto x lessthanorequalto 2 pi g(x) = 2 cot(x) - x + 1/x: -pi/2 lessthanorequalto x lessthanorequalto 7 pi/8 h(x) = 1 - ln(x)/1 + (1.8 - 0.5 cos (pi/6))^2: 0 lessthanorequalto x lessthanorequalto 3 piExplanation / Answer
Answer:
f = @(x) x^2*sin(3x)- 2;
g = @(x) 2cot(x)-x+1/x;
h = @(x) 1-ln(x)/1+(1.8-0.5*cos(pi/6))^2
figure
fplot(f,[0,2*pi])
xlabel('x')
ylabel('f(x)')
title('f(x) =x^2*sin(3*x) - 2')
figure
fplot(g,[-pi/2,7*pi/8])
xlabel('x')
ylabel('g(x)')
title('g(x) = 2*cot(x)-x+1/x')
figure
fplot(h,[0,3*pi])
xlabel('x')
ylabel('h(x)')
title('h(x) = 1-ln(x)/1+(1.8-0.5*cos(pi/6))^2')