ERROR: Z must be a matrix, not a scalar or vector
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
David Miller
le 27 Juil 2016
Réponse apportée : John D'Errico
le 27 Juil 2016
Grid = linspace(0,2*pi);
xAxis = (prams.Radius + prams.radius*cos(Grid)).*cos(Grid);
yAxis = (prams.Radius + prams.radius*cos(Grid)).*sin(Grid);
zAxis = prams.radius.*sin(Grid);
surf(xAxis,yAxis,zAxis);
hold on;
Why is it throwing the error: Z must be a matrix,not a scalar or vector
0 commentaires
Réponse acceptée
John D'Errico
le 27 Juil 2016
READ THE ERROR MESSAGE.
What is the variable grid? (Hint, a vector)
What shape are each of the variables xAxis, yAxis, zAxis? Note that the shape of the vector GRID propagates through these computations. So they are vectors also.
Now re-read the error message. Surf requires an array. You passed it a vector. What you really wanted to do, we cannot know.
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Lighting, Transparency, and Shading 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!