I am trying to plot a function and its derivative using fplot.
fplot('3*x*sin(x) - 2*x', [-2*pi 2*pi], 'r')
This is working, But the command below is showing error.
fplot('diff(3*x*sin(x) - 2*x)', [-2*pi 2*pi], 'g')
Error Shown
??? Subscripted assignment dimension mismatch.
Error in ==> fplot at 105
x = xmin+minstep; y(2,:) = feval(fun,x,args{4:end});
Please give me some suggestions?
d = diff(3*x*sin(x)-2*x)gives the derivative of that function.fplot('d', [-2*pi 2*pi], 'g')gives a wrong plot