How can I plot the fft of a pressure data?
10 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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;
0 Kommentare
Akzeptierte Antwort
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
Weitere Antworten (1)
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
0 Kommentare
Siehe auch
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!