How to choose amplitude at harmonics frequency by FFT method

Status
Not open for further replies.

kanokwat

Newbie level 4
Joined
Nov 30, 2009
Messages
5
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,312
my code is

Fs=5000
T=1/Fs
L=5000
t=[0:L-1]*T
exam1= 10*sin(2*pi*50*t)+5*sin(2*pi*100*t)+2*sin(2*pi*200*t)
figure(1)
plot(t(1:800),exam1(1:800))
title(' x(t)')
xlabel('time(s)')
ylabel('X')

% use FFTmethod

NFFT = 2^nextpow2(L); % Next power of 2 from length of y
Y = fft(exam1,NFFT)/L;
f_f = Fs/2*linspace(0,1,NFFT/2);
figure(2) % Plot single-sided amplitude spectrum.
k_k = 2*abs(Y(1:NFFT/2));
figure(2)
bar(f_f(1:500),k_k(1:500))
title('Single-Sided Amplitude Spectrum of x(t)')
xlabel('Frequency (Hz)')
ylabel('|X(f)|')


now i want amplitude at 50,100 and 200 Hz
how can i do that???
 

you can check the element value of k_k directly.
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…