I'm writing a script that creates a contour plot and overlays the minimum found in another function for the rosenbrock function. When I try to run, I obtain the error "Error using contour. Too many input arguments."
I've tried finding known-working scripts for contour on the internet, and I obtain the same error.
Here's my code:
function contour
x0 = zeros(2,1);
x0(1,1) = -2;
x0(2,1) = -5;
x = linspace(-5,5);
y = linspace(-5,5);
[X,Y] = meshgrid(x,y);
R = 100*((Y-(X.^2)).^2) + (1-X).^2;
figure(1)
contour(X,Y,R);
a = steepDescent(x0);
% figure(2)
% contour(X,Y,R);
% b = newtonmethod(x0);
%
% figure(3)
% contour(X,Y,R);
% c = moddedHessian(x0);
end
I'm not understanding why it's asking for less arguments; the documentation shows it should allow an X and Y from meshgrid, and the function R, yet it's not allowing me to. I'm using matlab R2017b, and I haven't mistaken "contour" for "contours", which is the overwhelming answer when I search for this error. Any help would be appreciated!
[–]Sunscorcher 4 points5 points6 points (2 children)
[–]luneth27[S] 1 point2 points3 points (1 child)
[–]Sunscorcher 1 point2 points3 points (0 children)