What Does this error even mean??
Mostrar comentarios más antiguos
[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*
Respuestas (1)
the cyclist
el 20 de Oct. de 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 comentario
Firew Biruu
el 20 de Oct. de 2013
Categorías
Más información sobre Surface and Mesh Plots en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!