How to find fft for part of my output? I mean after removing the initial transient of my data, I need for only x(4000:5000).

1 view (last 30 days)
Avan Al-Saffar
Avan Al-Saffar on 23 May 2016
x and t are vectors of 0:0.1:5000;
n = length(x);
dt = t(end)/(n-1);
Fs=1/dt ;
NFFT = n ;
y=fft(x,NFFT) ;
f=(Fs/2)*linspace(0,1,NFFT/2 +1)*2*pi;
figure(1)
subplot(2,1,1)
plot(t(4000:5000),x(4000:5000))
figure(1)
subplot(2,1,2)
plot(f,y(1:NFFT/2 +1));
figure(3)
plot(abs(f),abs(y(1:NFFT/2+1)));
Pow = abs(y(1:NFFT/2 +1)).^2;
Pow(1) = 0;
figure(4)
plot(f,Pow)

Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!