How to Plot a 3D Minimization Function in MATLAB?

Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
1 reply · 2K views
ericdavid
Messages
9
Reaction score
0
Hi to everyone,

I'm trying to plot a 3D graph on MATLAB but I do not know how.
The function that I want to plot is: y=fminbnd(@(x) wei(x,shape,scale,tw,tf),x0,x1).
I would like to plot the minimization of the function wei (y) in function of the shape and the scale.
Wei is a function that I have created and only has one output.
Tw and tf are known parameters, and x0, x1 the range where I want to optimize the function, as well known.

To sum up, I want to plot y, shape and scale in the same graph.

Thanks!
 
Physics news on Phys.org
How is this a 3D graph? You have y as a function of a single variable, x. That makes it a 1-D relationship which can be plotted with a regular function like plot(). Now, I've never used fminbnd() nor wei(). When you run this, is y a 3D array, with 3 indexes instead of only 1? What does

whos y

report to the command window? Is y a 1-D vector, or a 3-D array?