Hi
I have a question about consulting a 3D graph design
I have in my data:
  • Samples
  • Frequency axis
  • And the amplitude by sampling for freq
How would you present this data in a three-dimensional graph
Functions like surf are irrelevant because the Z axis does not depend on X&Y
Z is a known value
tnx :)
Example

댓글 수: 5

Rik
Rik 2020년 11월 13일
What kind of plot do you want? A scatterplot?
Bjorn Gustavsson
Bjorn Gustavsson 2020년 11월 13일
What you have presented is data Z with size [32 x 7] at 7 frequencies and 32 "samples", in a plaid frequency-sample grid. For that surf is a reasonably suitable function to illustrate the data, as is pcolor (except for the fact that the last row and column disappears). You could also use scatter, (or plot3).
Unless you can explain why surf is "irrelevant".
Shahar ben ezra
Shahar ben ezra 2020년 11월 13일
First of all thanks for the help
I'm just not sure how to display the graph
In the SURF function I need to multiply the Z axis as a function of XY
for example
Z = sinx * exp (y)
In this case Z is a known value
Is a value I get directly from measuring instruments
I therefore consult how you would present a sub-dimensional surface to this data
Rik
Rik 2020년 11월 13일
You don't need to do that, it is just a way in which you can create some example data. You can just use the actual Z values.
Shahar ben ezra
Shahar ben ezra 2020년 11월 13일
편집: Shahar ben ezra 2020년 11월 13일
this is work!!
tnx!!

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

 채택된 답변

Cris LaPierre
Cris LaPierre 2020년 11월 13일
편집: Cris LaPierre 2020년 11월 13일

0 개 추천

I think the natural choice here is a spectrogram. Samples go along one axis, frequency along the other, and color is used to convey power. Look at some of the examples on the linked page.

댓글 수: 6

Shahar ben ezra
Shahar ben ezra 2020년 11월 13일
This is what I was looking for!
But I could not get a graph
Can you see where my error is?
Cris LaPierre
Cris LaPierre 2020년 11월 13일
편집: Cris LaPierre 2020년 11월 13일
Could you copy/paste your code here? Use the CODE formatting option. You can attach your data using the paperclip icon as well.
%%
clc, clear
my_date = readmatrix('3D PLOT');
vec_x_freq = my_date(1,2:end)
vec_y_samp = my_date(3:end,1)
matrix_z = (my_date(3:end,2:end))
figure(1)
spectrogram(vec_x_freq,vec_y_samp,matrix_z)
Ok, so spectrogram is designed to take in the raw data and extract the frequency content. Your data appears to have already done that. So you really do just need a visualization method.
A simple 2D approach could be heatmap.
my_date = readmatrix("3D PLOT.xlsx");
vec_x_freq = my_date(1,2:end);
vec_y_samp = my_date(3:end,1);
matrix_z = (my_date(3:end,2:end));
figure
heatmap(matrix_z,"XDisplayLabels",vec_x_freq)
colormap parula
If you want a 3D plot, then surf would work, though your data doesn't make that a nice visualization.
figure
s=surf(matrix_z);
s.FaceColor = "interp";
colorbar
Another option might be a 3D bar chart.
figure
bar3(-matrix_z)
zlim([70 100])
xticklabels(vec_x_freq)
xlabel('Frequency')
ylabel('Sample')
zticklabels("-"+zticklabels);
Cris LaPierre
Cris LaPierre 2020년 11월 13일
편집: Cris LaPierre 2020년 11월 13일
The best way to explore plotting options is to select the variable in your workspace, then open the Plots tab. All possible options for that variable will be displayed. Expand the list to see them all. Find one you like and select it.
Shahar ben ezra
Shahar ben ezra 2020년 11월 13일
Wow
you made my day
Thanks!

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Data Distribution Plots에 대해 자세히 알아보기

제품

릴리스

R2020b

질문:

2020년 11월 13일

댓글:

2020년 11월 13일

Community Treasure Hunt

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

Start Hunting!

Translated by