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.
Shahar ben ezra
Shahar ben ezra 2020 年 11 月 13 日
%%
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)
Cris LaPierre
Cris LaPierre 2020 年 11 月 13 日
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 ExchangeData Distribution Plots についてさらに検索

製品

リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by