wny fft does't work with different signal?
Show older comments
I am using fft to extract freq content in my two type of time series. First, time series (file sig_fft.txt) look good and showing some speaktral peak. but unfortunately for second time series (event.txt) no single spectral appear. I even using IFFT as checking wheater fft result can get back the original signal. For me seems FFT is work well. But I still wonder why my FFT having strange result on second one. Can anyone explain why ? Or do I make something wrong in my coding?
Second thing, I wonder about the amplitude on freq domain, does it shoul be the same in the time domain? I read several literature taht it relates to power which is square of amplitude, but why some coding that i found abot fft using 2*abs(fft_result)?
please help this beginner to get more about fft
here modification the code and time series that I use
%PERFORM FFT of data TO GET FREQ CONTENT
data=load("event.txt");
n=length(data(:,1));
srate=1000; %sampling rate
nyq=srate/2;
dataX=fft(data(:,2))/n;
hz=linspace(0,nyq,floor(n/2)+1);
figure (1)
subplot(211)
plot(data(:,1),data(:,2))
xlabel('Time(sec)'), ylabel('Amplitude')
subplot(212)
plot(hz,2*abs(dataX(1:length(hz))),'-r'), xlabel('Freq(Hz)')
%set(gca,'XLim',[0 2],'YLim',[0 100])
%Perform IFFT TO CONSTRUCT ORIGINAL SIGNAL
recon_data=ifft(dataX)*n;
figure(2)
subplot(211)
plot(data(:,1),data(:,2)), xlabel('Time(sec)')
legend('original data')
title('inverse fourier transform')
subplot(212)
plot(data(:,1),real(recon_data),'-r')
legend('reconstruction data')
Accepted Answer
More Answers (0)
Categories
Find more on Get Started with Signal Processing Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
