Create two vectors X and Y of values from (-pi) to pi with a spacing of pi/10. Define the vector Z as: Z = (sin(sqrt(x^2+y^2)))/(sqrt(x^2+y^2))
Afficher commentaires plus anciens
Im trying to plot function. I have wrote x=[-pi:pi/10:pi] and y=[-pi:pi/10:pi]. Also Z = (sin(sqrt(x.^2+y.^2)))/(sqrt(x.^2+y.^2)). When I try to plot the function z somehow gets to be only one number such as -0.0227 and I get error 'Vectors must be the same lengths'. Please help me to get this problem right
Réponse acceptée
Plus de réponses (2)
Lisa
le 18 Mar 2014
0 votes
Marta Salas
le 18 Mar 2014
Modifié(e) : Marta Salas
le 18 Mar 2014
[x,y] = meshgrid(-pi:pi/10:pi)
z = (sin(sqrt(x.^2+y.^2)))./(sqrt(x.^2+y.^2))
mesh(x,y,z)
1 commentaire
Lisa
le 18 Mar 2014
Catégories
En savoir plus sur Title dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!