ERROR: Z must be a matrix, not a scalar or vector

1 次查看(过去 30 天)
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

采纳的回答

John D'Errico
John D'Errico 2016-7-27
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 个)

类别

Help CenterFile Exchange 中查找有关 Shifting and Sorting Matrices 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by