How do I plot this function in MATLAB?
16 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Michael
le 14 Oct 2014
Réponse apportée : Shashyabh Ray
le 2 Mar 2021
Hello Everyone,
I am having trouble with entering the equation Z = sin(sqrt(x.^2 + y.^2))/(sqrt(x.^2 + y.^2)) into MATLAB so I can plot it as a surface plot. The MATLAB program keeps on turning this equation into the value -0.0227, rather than accecpting it as an equation (which make no sense).
This issue is preventing me from making a surface plot, as I am told that Z is a scalar or vector (because the program computed it as that for some reason), rather than a matrix.
Can anyone tell me what I am doing wrong with either the syntax or another aspect of the entry?
I would greatly appreciate it.
Thank you
1 commentaire
Réponse acceptée
Plus de réponses (2)
Mischa Kim
le 14 Oct 2014
Modifié(e) : Mischa Kim
le 14 Oct 2014
Michael, use something like
[x,y] = meshgrid(0:0.1:5,0:0.1:5);
Z = sin(sqrt(x.^2 + y.^2))./(sqrt(x.^2 + y.^2)) ;
surf(x,y,Z)
Shashyabh Ray
le 2 Mar 2021
how to plot y=(exp.^(sqrt(x)))./(x*x - x*(exp(x))).^(1/3);
0 commentaires
Voir également
Catégories
En savoir plus sur Surface and Mesh Plots dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!