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

2 ビュー (過去 30 日間)
Tino
Tino 2021 年 4 月 13 日
コメント済み: Tino 2021 年 6 月 3 日
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
Tino 2021 年 4 月 13 日
Yes thanks for responding, I will like to display the surface as points and the z value encoded as color.
Tino
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 日
Hi,
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);
surf(X,Y,Z);
For more information, check out the documentation link below: -

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSurface and Mesh Plots についてさらに検索

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by