Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- %take the fourier transform
- xdft = fft(x);
- xdft = xdft(1:length(x)/2+1);
- % create a frequency vector
- freq = 0:Fs/length(x):Fs/2;
- % plot magnitude
- figure(2)
- semilogx(freq,20*log10(abs(xdft)));
- xlabel('f(Hz)');
- title('FFT of signal');
- %locs is now in frequency
- [pks,frqs] = findpeaks(abs(X),freq);
- figure(3)
- plot(xdft(locs), pks, 'or')
Advertisement
Add Comment
Please, Sign In to add comment