Effacer les filtres
Effacer les filtres

How do I plot 3-dimentional graph of the following function? Can Plot3 function do this?

1 vue (au cours des 30 derniers jours)
fun=@(x,y)100*(y-x^2)^2+(1-x)^2;

Réponse acceptée

Walter Roberson
Walter Roberson le 9 Oct 2015
fun = @(x,y)100*(y-x.^2).^2 + (1-x).^2;
x = linspace(-10,10);
y = linspace(-50,-30);
plot3d(x, y, fun(x,y))
  3 commentaires
Steven Lord
Steven Lord le 9 Oct 2015
Your function is defined in such a way that you can pass x and y matrices, not just vectors or scalars, into it. Because of that take a look at the MESHGRID function to generate the data points at which you evaluate and plot your function.
Shawn Miller
Shawn Miller le 10 Oct 2015
Thanks Steven, you're right. Also thanks to Walter.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur 2-D and 3-D Plots dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by