What Does this error even mean??
Show older comments
[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*
Answers (1)
the cyclist
on 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 Comment
Firew Biruu
on 20 Oct 2013
Categories
Find more on Surface and Mesh Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!