How to Plot a 3D Minimization Function in MATLAB?

Click For Summary
SUMMARY

The discussion focuses on plotting a 3D minimization function in MATLAB using the function fminbnd with a custom function wei. The user aims to visualize the output y as a function of two parameters, shape and scale, while optimizing over a specified range [x0, x1]. Clarification is sought on how to represent a 1-D relationship in a 3D graph, as the output y is derived from a single variable x.

PREREQUISITES
  • Familiarity with MATLAB programming environment
  • Understanding of optimization functions, specifically fminbnd
  • Knowledge of function plotting in MATLAB, particularly plot()
  • Basic understanding of custom function creation in MATLAB
NEXT STEPS
  • Learn how to create 3D plots in MATLAB using meshgrid and surf
  • Explore the use of fminbnd for multi-variable optimization
  • Investigate how to visualize multiple parameters in a single plot using plot3
  • Study the structure and output of custom functions in MATLAB to ensure correct dimensionality
USEFUL FOR

MATLAB users, data scientists, and engineers interested in optimization and 3D data visualization techniques.

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?
 

Similar threads

  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 5 ·
Replies
5
Views
4K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 11 ·
Replies
11
Views
3K
  • · Replies 2 ·
Replies
2
Views
4K
  • · Replies 1 ·
Replies
1
Views
5K
  • · Replies 7 ·
Replies
7
Views
2K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K