Mercurial > hg > ishara
annotate dsp/realfft.m @ 32:c3b0cd708782
Imported core dsp tools.
author | samer |
---|---|
date | Sun, 20 Jan 2013 13:48:47 +0000 |
parents | |
children |
rev | line source |
---|---|
samer@32 | 1 function [y,f] = realfft(x,nfft) |
samer@32 | 2 % realfft - Do FFT assuming real data, returning complex half spectrum |
samer@32 | 3 % |
samer@32 | 4 % realfft :: |
samer@32 | 5 % [[L,T]->real] ~'sequence of T L-point frames', |
samer@32 | 6 % N:natural ~'FFT size' |
samer@32 | 7 % -> [[M,T]->complex] ~'sequence of T M-point complex spectra', |
samer@32 | 8 % [[M]] ~'normalised centre frequency for each bin'. |
samer@32 | 9 % |
samer@32 | 10 % Note that M=dftbins(N). |
samer@32 | 11 |
samer@32 | 12 % apply the window and do FFT on each column, then |
samer@32 | 13 % assume it's a real signal and discard half the bins |
samer@32 | 14 y = fft(x,nfft); |
samer@32 | 15 select=1:dftbins(nfft); |
samer@32 | 16 y = y(select,:); |
samer@32 | 17 % compute the normalised frequency for each bin |
samer@32 | 18 f=(select-1)/nfft; |