Error using mesh, Z must be a matrix
14 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Espen André
le 21 Oct 2014
Modifié(e) : Mischa Kim
le 21 Oct 2014
I don't know why, but z won't be registered as a martix even when it calculates it as amtrix.
x=linspace(0,4,2);
y=linspace(0,4,2);
z=sin(pi.*x).*sin(pi.*y);
mesh(x,y,z)
0 commentaires
Réponse acceptée
Mischa Kim
le 21 Oct 2014
Modifié(e) : Mischa Kim
le 21 Oct 2014
Espen, use
x = linspace(0,4,20);
y = linspace(0,4,20);
[X,Y] = meshgrid(x,y); % create a grid of data points
Z = sin(pi.*X).*sin(pi.*Y);
mesh(X,Y,Z)
Z needs to be an n-by-m, just like X and Y.
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Creating and Concatenating Matrices 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!