How to draw this 3D plot (PSD cone)
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Dian-Jing
le 7 Jan 2015
Réponse apportée : Stefan Reich
le 29 Juil 2016
Hi all:
I have vectors: x,y,z with the same dimension.
I use plot(x,y,z,',') to plot it. The following is the code:
clear all;
close all;
clc
num = 0;
%%loop
for x = 0 : .02 : 1
for y = -1 : .02 : 1
for z = 0 : .02 : 1
num = num + 1;
A = [x y;y z];
a = eig(A);
if (a(1) >= 0) && (a(2) >= 0)
vecx(num) = x;
vecy(num) = y;
vecz(num) = z;
else
vecx(num) = NaN;
vecy(num) = NaN;
vecz(num) = NaN;
end
end
end
end
%%picture
figure(1)
plot3(vecx,vecy,vecz,'.')
axis([0 1 -1 1 0 1])
The answer should look like:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/146723/image.png)
However, my answer is:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/146724/image.png)
The similar shape, but different result. How to fix it?
How to draw the lines on the surface?
Thanks,
0 commentaires
Réponse acceptée
Stefan Reich
le 29 Juil 2016
Dear Dian-Jing, Usually I would suggest using
meshgrid()
surf()
In your case, downloading and installing this file might just be easier! https://www.mathworks.com/matlabcentral/fileexchange/5105-making-surface-plots-from-scatter-data Best, S
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Graphics Performance dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!