How to get output using a function with two parameters of different range
2 views (last 30 days)
Show older comments
Commented: Tino on 3 Jun 2021
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
Abhishek Gupta on 16 Apr 2021
Edited: Abhishek Gupta on 16 Apr 2021
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: -
More Answers (0)
Find more on Surface and Mesh Plots 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!