Question: MATLAB Only I tried using this code (below) provided by an expert, but I keep getting an error message that says Unrecognized function or variable
MATLAB Only

I tried using this code (below) provided by an expert, but I keep getting an error message that says "Unrecognized function or variable 'xvals1'."
>> h=(3-2)/130;
>> xvars1=2:h:3;
>> xvars2=0:h:2;
>> xvars3=3:h:4;
>> yvals1 = feval('myfilename',xvars1);
>> yvals2 = feval('myfilename',xvars2);
>> yvals3 = feval('myfilename',xvars3);
>> figure
>> plot(xvals1,yvals1)
>> title(f(x)=2x*cos(2x)-(x-2)^2 between [2,3])
>> xlabel("x")
>> ylabel(y)
Another extra credit option. Create a function m-file for the function f(x)=2xcos(2x)(x2)2. Use the feval matlab command, to evaluate the function, e.g.-with xvals =a:h:b, then yvals = feval('mymfilename',xvals). Use the plot command, e.g., plot(xvals,yvals) , to graph the function over the intervals [2,3],[0,2] and [3,4]. Use n=130 points with step size h=nba for each case. Provide a printout of each plot and a printout of your function m-file
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
