Adding third dimenstion to 2D plot
古いコメントを表示
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 件のコメント
Jan
2012 年 7 月 24 日
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.
回答 (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)
カテゴリ
ヘルプ センター および File Exchange で General Applications についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!