Adding third dimenstion to 2D plot
Afficher commentaires plus anciens
I generated the following 2D plot:
<<http://i.stack.imgur.com/Bvt6W.jpg>>
The code I used for this looks as follows:
res = zeros(2, 320);
index = 1:320;
% assign some data to the res array and then approximate
PD = fitdist(index','normal', 'frequency', res(1,:)')
pdfNormal = normpdf(index',PD.mu,PD.sigma);
plot(index', pdfNormal, 'Color', 'r', 'LineWidth', 2);
hold on;
PD = fitdist(index','normal', 'frequency', res(2,:)')
pdfNormal = normpdf(index',PD.mu,PD.sigma);
plot(index', pdfNormal, 'Color', 'b', 'LineWidth', 2);
Now I am wondering how I could add a third dimension to this plot? Essentially, I would like to plot another 2 normal distributions, but this time in the Z-axis, ie., in the third dimension.
Anyone an idea how I could do that easily?
Thanks so much!
1 commentaire
Jan
le 24 Juil 2012
I've tried to remove the space before the embedded picture. But the picture too large to match in the borders. Therefore I've re-instered the space again.
Réponses (1)
z = repmat(0, numel(index), 1);
line(index', pdfNormal, z, 'Color', 'r', 'LineWidth', 2);
hold on;
...
z(:) = 1;
line(index', pdfNormal, z, 'Color', 'b', 'LineWidth', 2);
...
z(:) = 2;
line(index', pdfNormal, z, 'Color', 'g', 'LineWidth', 2);
...
view(3)
Catégories
En savoir plus sur General Applications dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!