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.

 Respuesta aceptada

Walter Roberson
Walter Roberson el 4 de Mayo de 2018
F = @(X,Y) arrayfun(@(x,y) giant([ x, y ]), X, Y) ;
fcontour(f)

Más respuestas (1)

Steven Lord
Steven Lord el 4 de Mayo de 2018

0 votos

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.

Categorías

Más información sobre 2-D and 3-D Plots en Centro de ayuda y File Exchange.

Preguntada:

el 4 de Mayo de 2018

Comentada:

el 5 de Mayo de 2018

Community Treasure Hunt

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

Start Hunting!

Translated by