What Does this error even mean??
Afficher commentaires plus anciens
[x, y, z]=meshgrid(0.5:0.05:0.5, 0.5:0.05:0.5, 0.5:0.05:0.5);
a=0;
for l=1:length(x)
for j=1:length(y)
for k=1:length(z)
a(l, j, k)=k-sqrt((0.25)-((0.58-(l).^2))-((0.58-(j).^2)));
end
end
end
surf(x,z,a)
*Error using surf (line 75)
Z must be a matrix, not a scalar or vector*
Réponses (1)
the cyclist
le 20 Oct 2013
The way you have defined x y and z, they are each just a single number (i.e. a "scalar").
I think maybe you meant
[x, y, z]=meshgrid(-0.5:0.05:0.5, -0.5:0.05:0.5, -0.5:0.05:0.5);
I still get an error from your code when I make that replacement, but I am not quite sure what you intended. I suggest you give
doc surf
a careful read.
1 commentaire
Firew Biruu
le 20 Oct 2013
Catégories
En savoir plus sur Mathematics 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!