How to get output using a function with two parameters of different range

조회 수: 2(최근 30일)
For instance, I have a function x = cb( a, b)
the paramter a ranges from 0 to 1 and b ranges from (2 to 20).
How do I perform a for loop to plot x for these parameters range.
Your help will be greatly appreciated
Best wishes
  댓글 수: 6
Tino 2021년 4월 13일
Also I would like to display in the plot the optimal values for x function and the value of a and b that gives the optimal x values if possible

댓글을 달려면 로그인하십시오.

채택된 답변

Abhishek Gupta
Abhishek Gupta 2021년 4월 16일
편집: Abhishek Gupta 2021년 4월 16일
As per my understanding, you want to display a surface plot between a, b, and x. You can do the same as follows: -
a = linspace(0, 1, 10);
b = linspace(2, 20, 10);
[X,Y] = meshgrid(a,b);
Z = cb(X, Y);
For more information, check out the documentation link below: -

추가 답변(0개)


Find more on Graphics Performance 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!

Translated by