Stacking Multiple 2D plots in one 3D plot

Hi,
I have 14 two dimensional plots and I want to show them all in a 3D plot like this:
I can plot the 14 plots in the same 2d plot but I want to have an offset between them and plot them in a 3d plot.
figure(1)
for i=1:size(nw,1)
h_FDD_dB(i) = plot(f_FDD,pow2db(SV_FDD{i,1}),'DisplayName',['SV1, No. of windows: ',num2str(i)]);
xlabel('Frequency (Hz)');
ylabel('Singular Value (Power Spectral Density)(dB)');
title('Singular Values of the SD Matrix')
xlim([0 60])
legend
hold on
grid on
end
legend(h_FDD_dB);
nw = 1:1:14;
and f_FDD & SV_FDD{i,1} are 65537*1 vectors.
Thanks,
Amir

 採用された回答

Adam Danz
Adam Danz 2021 年 8 月 9 日

1 投票

Check out the following resources. If you get stuck implementing a solution, share your updated code and we can help you get unstuck.

7 件のコメント

Amir Hosein Shokouhy
Amir Hosein Shokouhy 2021 年 8 月 9 日
編集済み: Amir Hosein Shokouhy 2021 年 8 月 9 日
Hi Adam,
This is very similar to what I wanna do:
I have trouble defining my variables though. My data is stored in cell arrays instead of just one table and I'm confused how to apply your solution to my problem. I'd really appreciate it if you could help me.
Thanks,
Amir
Adam Danz
Adam Danz 2021 年 8 月 9 日
You can also do it in a loop.
It will look something like this (not tested).
figure(1)
hold on
for i=1:size(nw,1)
h_FDD_dB(i) = plot3(i,f_FDD,pow2db(SV_FDD{i,1}),'DisplayName',['SV1, No. of windows: ',num2str(i)]);
end
legend(h_FDD_dB);
xlabel('Number of windows') % ???
ylabel('Frequency (Hz)');
zlabel('Singular Value (Power Spectral Density)(dB)');
title('Singular Values of the SD Matrix')
ylim([0 60]) %???
grid on
view(3)
Amir Hosein Shokouhy
Amir Hosein Shokouhy 2021 年 8 月 9 日
I get the "Vectors must be the same length." error, that's where I get confused.
Adam Danz
Adam Danz 2021 年 8 月 9 日
Instead of plot3(i,..., replace i with repmat(i,size(f_FDD))
Amir Hosein Shokouhy
Amir Hosein Shokouhy 2021 年 8 月 9 日
Perfect, thank you!
Adam Danz
Adam Danz 2021 年 8 月 9 日
Great! You can also switch the first and second inputs to control whether the data vary across the X or y axes.
Amir Hosein Shokouhy
Amir Hosein Shokouhy 2021 年 8 月 10 日
I'll give it a try, thanks again Adam!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by