How to get output using a function with two parameters of different range
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Tino
el 13 de Abr. de 2021
Comentada: Tino
el 3 de Jun. de 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
Best wishes
6 comentarios
Respuesta aceptada
Abhishek Gupta
el 16 de Abr. de 2021
Editada: Abhishek Gupta
el 16 de Abr. de 2021
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: -
Más respuestas (0)
Ver también
Categorías
Más información sobre Surface and Mesh Plots en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!