Z must be a matrix, not a scalar or vector.
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
t=0:30
x=(1+0.25.*cos(45.*t)).*cos(t)
y=(1+0.25.*cos(45.*t)).*sin(t)
[X,Y] = meshgrid(x,y)
Z=t+2.*sin(45.*t)
surf(X,Y,Z)
not sure why it keep told me the "Z must be a matrix, not a scalar or vector."
Thanks for the help!!
1 Kommentar
Voss
am 3 Dez. 2022
Maybe you intend to make a line in 3D rather than a surface?
t = 0:30;
x = (1+0.25.*cos(45.*t)).*cos(t);
y = (1+0.25.*cos(45.*t)).*sin(t);
z = t+2.*sin(45.*t);
plot3(x,y,z)
Antworten (2)
Eric Delgado
am 3 Dez. 2022
You have have a grid created by meshgrid, so you need a matrix to fill this grid. Not a vector...
It is what it is! :)
t=0:30;
x=(1+0.25.*cos(45.*t)).*cos(t);
y=(1+0.25.*cos(45.*t)).*sin(t);
[X,Y] = meshgrid(x,y);
Z = randn(size(X));
surf(X,Y,Z)
0 Kommentare
Siehe auch
Kategorien
Mehr zu Surface and Mesh Plots finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!