x = linspace (0,10);x = 0:0.5:10;y = 2-10*x.*exp(-.8*x);plot (x, y); grid on;x = 0y = 2-10*x.*exp(-.8*x)f = @(x) 2-10*x.*exp(-.8*x)[xr fx] = fzero(f, 0)[xrr fx] = fzero(f, 4)[xmin, fmin]=fminbnd(f,1,2)%PART 2
line12>>subplot(1,2,2) surf(xgrid,ygrid,func(xgrid,ygrid))[xgrid, ygrid]=meshgrid(-2:0.1:0,0:0.1:3);func= @(x,y) 2+x-y+2*x.^2+2*x.*y+y.^2subplot(1,2,1); contour(xgrid,ygrid,func(xgrid,ygrid))subplot(1,2,2); surf(xgrid, ygrid, func(xgrid,ygrid))f = @(x) 2+x(1)-x(2)+2*x(1)^2+2*x(1)*x(2)+x(2)^2[x, fval]=fminsearch(f,[-.5, 0.5])
MATLAB: Does the programm do not run the script and continues to get unexpected expression
line 12unexpected matlab expression
Best Answer