Filter löschen
Filter löschen

Plot 3D FFT over time with Surf - How to set the Axis?

1 Ansicht (letzte 30 Tage)
Rudolf Hoehler
Rudolf Hoehler am 11 Okt. 2012
Hi there,
I'm sampling data from an EEG in a C++ program that writes the FFT of a sample to a csv file. After the experiment I read all the csv's into matlab and end up with a matrix in which each column represents a sampled FFT: [InputHistory]
TIME__________(Columns)_____________>
R1_C1_S1 | R1_C2_S1 | R1_C3_S1
R2_C1_S2 | R2_C2_S2 | R2_C3_S2
R3_C1_S3 | R3_C2_S3 | R3_C3_S3
R4_C1_S4 | R4_C2_S4 | R4_C3_S4
R5_C1_S5 | R5_C2_S5 | R5_C3_S5
Where R=row,C= column and S = sample. I hope you understand my data structure? Each column is an FFT.
Below is result of the command:
surf( InputHisotry)
How can I set the values of the Highlighted X-axis? I know I can call surf(x,y,Z), but I don't have an x,y, and Z. I just have a Z and an x? I'm not trying to plot a surface function with 3 variables like they use in the examples.
Thank you for your time,
Rudolf
EDIT: set(gca,'XTick'_,myrange_) changes the ticks on the "y" axis so obviously I have my axis mixed around. regardless, set(gca,'YTick', 0:0.25:63.5) sets the ticks from 0 - 63.5, I need 0 - 63.5 to span the 0 - 100 shown in the plot.

Antworten (1)

Star Strider
Star Strider am 11 Okt. 2012
Bearbeitet: Star Strider am 11 Okt. 2012
I am guessing here because I am not certain that I completely understand your question. (I do not understand the reason your set(gca, 'YTick',... command does not work in your application.)
To start, I suggest you use meshgrid to create your x and y axes for your figure. For example:
x = 0:0.25:63.5;
y = 1:30;
[X, Y] = meshgrid(x, y);
surf(X, Y, InputHisotry)
You may have to experiment a bit to be sure that the dimensions of ‘X’, ‘Y’, and ‘InputHisotry’ all match, but if I understand your question correctly, this approach may solve your problem.
If you only have 100 elements to your x-axis vector, it may be appropriate to use:
x = linspace(0, 63.5, 100);
because the x-axis you specified has 255 elements, but the x-axis in the plot you posted seems to have 100 elements.
I also suggest you consider ribbon for your plot. It may make it easier for you to see the frequency components of your EEG signals.

Kategorien

Mehr zu Graphics Performance finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by