Hi there,
I have a table, each column represents the amplitude of frequency on different flow rates of a centrifugal pump, like this.
i plot spectrum in 2d but looks like this:
I want to plot this spectra on different flow rates in 3D, and should looks like this:
How can i do this?
Thanks!

 채택된 답변

Adam Danz
Adam Danz 2020년 4월 1일
편집: Adam Danz 2020년 4월 1일

1 개 추천

What does your code look like that produces the 2D plot?
If the entire matrix is the 1st and only input to waterfall(), it should produce a 3D waterfall plot.
waterfall(Z) creates a waterfall plot, and uses the column and row indices of the elements in Z as the x- and y-coordinates.
Note that neither of the plots in your question show a waterfall plot. As darova mentioned in the comments under your quesiton, perhaps you're looking for the gool ol' fashion plot3(X,Y,Z).
[x,y] = meshgrid(1:size(T,2), 1:size(T,1)); % T is your table
z = T{:,:};
plot3(x,y,z)
grid on

댓글 수: 5

Bizau Florin
Bizau Florin 2020년 4월 1일
Thanks a lot!
It is working, but how can i do instead of 1,2...6 values on z axis, having mt flow rates (187, 282 .... 1000 m3/h)?
Adam Danz
Adam Danz 2020년 4월 1일
편집: Adam Danz 2020년 4월 1일
The meshgrid() function I used defines the x and y values of your 3D plot as the column and row numbers of your matrix.
If you want to use different x,y values, use different inputs to meshgrid.
For example,
[x,y] = meshgrid([87, 282 . . . 1000], 1:size(T,1));
If you're working with a 6401x6 matrix, be sure you chose 6 values.
Examples:
80 : 184: 1000
% or
linspace(80, 1000, 6);
Bizau Florin
Bizau Florin 2020년 4월 1일
Thanks a lot again for your help!
Adam Danz
Adam Danz 2020년 4월 1일
Glad I could help!
Guglielmo Giannetti
Guglielmo Giannetti 2023년 4월 8일
Hello Adam,
in the Bizau's plot 3D he obtain different colour for each graphs at different flow rates.
How it is possible to have the graduated colour on all the graphs?
Thank you

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

제품

릴리스

R2019a

질문:

2020년 4월 1일

댓글:

2023년 4월 8일

Community Treasure Hunt

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

Start Hunting!

Translated by