How can I plot the fft of a pressure data?

10 Ansichten (letzte 30 Tage)
abstine33
abstine33 am 18 Okt. 2016
Beantwortet: Youssef Essakhi am 25 Apr. 2018
Hello. I have a question to all. I really want to know to plot fft my pressure data. So, I tried to do FFT, but it didn`t go well. If there is someone can catch mistake, then please may I get some advise? I attached my file!
[fname,pathname] = uigetfile('.csv','Select CSV File to Load, Plot, Compute RMS & FFT');
disp([pathname fname])
data = csvread([pathname fname]);
[N,m] = size(data);
t = data(:,1); %time in seconds
x = data(:,2); %array of data
Fs = 1/(t(2)-t(1));
figure(1)
plot(t,x)
xlabel('Time (s)');
ylabel('Pressure');
title(chamber pressure);
grid on;
freq = 0:Fs/length(x):Fs/2; %frequency array for FFT
xdft = fft(x); %Compute FFT
xdft = 1/length(x).*xdft; %Normalize
xdft(2:end-1) = 2*xdft(2:end-1);
figure(3)
plot(freq,abs(xdft(1:floor(N/2)+1)))
xlabel('Frequency (Hz)');
ylabel('Fourier spectrum');
title(['FFT' chamber pressure]);
grid on;

Akzeptierte Antwort

Star Strider
Star Strider am 18 Okt. 2016
I continue to recommend the R2015a documentation for fft (link). Specifically not the code between the first (top) two plot figures.
  6 Kommentare
abstine33
abstine33 am 19 Okt. 2016
OH MY GOD! You are genius!!
Thank you so much to make FFT plot!!!! :)
I think the peaks on 2700~2600 Hz is caused by the Helmholz. But as your advise, I will try to use the findpeaks.
Again, thank you all your kind answers!
Star Strider
Star Strider am 19 Okt. 2016
Thank you!
My pleasure!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

Youssef Essakhi
Youssef Essakhi am 25 Apr. 2018
xdft = 1/length(x).*xdft; %Normalize
xdft(2:end-1) = 2*xdft(2:end-1);
plz i don't understand this link . can you explain to me . thank you

Kategorien

Mehr zu Fourier Analysis and Filtering 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