annotate dsp/realfft.m @ 61:eff6bddf82e3 tip

Finally implemented perceptual brightness thing.
author samer
date Sun, 11 Oct 2015 10:20:42 +0100
parents c3b0cd708782
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;