fcontour error: not enough input arguments

I have an objective function:
function thetadot = giant(x)
thetadot = -sqrt((((45*-9.8*(x(1)+x(2)))*((0.5*4410*(x(2).^2))/(45*-9.8*(x(1)+x(2)))))-(0.5*4410*(x(2).^2))-(0.5*45*((4*pi*sqrt(0.01-x(2).^2)).^2))/(0.5*45*((x(1)+x(2)).^2))))
which I'd like to optimize. I'm trying to plot it to visualize before I continue with constraints. I keep getting the error: Not enough input arguments when plotting fcontour(giant). Any help is appreciated.

 Accepted Answer

F = @(X,Y) arrayfun(@(x,y) giant([ x, y ]), X, Y) ;
fcontour(f)

More Answers (1)

What requirements does the documentation for the fcontour function say it has for the function you pass into it as the first input argument F?
"The function must accept two matrix input arguments and return a matrix output argument of the same size."
Does your function satisfy the requirements? As written, it does not. Your function seems to assume that it will be called with a vector with two elements.

Categories

Find more on 2-D and 3-D Plots in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!