How to plot a 3D plot from three linear vectors?
32 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I have three vectors x ,y and z. The size of all of them are same.But all of them are 1D arrays. I want to draw a 3D plot from them. Let me give it in code form as below:
x=linspace(0,180,100);% 1st vector
y=x;% 2nd vector
z=rand(1,100)*1e-7;% 3rd vector
I tried to convert both x and y to 2D vectors as below:
[x,y]=meshgrid(x,y);
But when I use the surface command or mesh command, it gives me error as:
Z must be a matrix, not a scalar or vector.
What to do?
0 commentaires
Réponse acceptée
Matt J
le 21 Fév 2022
Modifié(e) : Matt J
le 21 Fév 2022
x=linspace(0,180,100);% 1st vector
y=x;% 2nd vector
z=rand(1,100)*1e-7;% 3rd vector
line(x,y,z); view(3)
2 commentaires
Matt J
le 21 Fév 2022
The 2nd problem is a little bit different from above.
If your first problem has been solved, please Accept-click the answer. If you have a new problem, please post it in a separate thread.
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur 2-D and 3-D Plots dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!