DSPRelated.com
Forums

Multiband Amplitude Compression in Freq. Domain

Started by aaab December 17, 2012
On Mon, 21 Jan 2013 07:25:30 -0600, aaab wrote:

> Hi all, > > When I use different number of samples to do the fft, > I get fft spectra values which are different in value. > So say I have a tone at 1500 Hz at sampling frequency of 20000 Hz of 1 > second duration. > First I take only the first 512 samples and find the fft. > Then I take only the first 1024 samples of the same input and find the > fft. The maximum absolute value of these two ffts are found to be > different. > > Please let me know what can I do to ensure that fft spectra values can > be compared irrespective of the number of samples taken for fft (or > window length). > > Here is the sample Matlab code for illustration. > > For compression in the frequency domain I need to address this issue. > >>>t= [1:20000];s = 0.999 * sin(2 * pi * 1500/20000 * t); > >>> s2 = s(1:512); fft_s2 = fft(s2); plot(abs(fft_s2)); > >>> s3 = s(1:1024)); fft_s3 = fft(s3); plot(abs(fft_s3)); > > It is seen that max(abs(fft_s2)) is different from max(abs(fft_s2)) > since number of samples are different. But I want to be able to compare > or > > get a relation between these values irrespective of the number of > samples used for fft. > > Thanks and regards, > AV
You did not post your values. Are they different by a factor of 2, or a factor of sqrt(2)? Or are they different by a percent or less? If it's one of the former two, then it's an artifact of the algorithm which you can take care of by scaling your results by the number of points. If it's the latter, then try taking your measurements again, but use a tone that'll fit an integer number of cycles into the number of points over which you FFT. I'm not sure what math package you're using (I come late to the thread and you haven't included context), and I don't care. What's important is that different math packages scale their FFT results differently. Some scale it so that a constant-amplitude tone always gives the same results (assuming an integer number of cycles), some just let it be scaled by the number of points. Nearly all of them use algorithms such that ifft(fft(x)) = x + numerical scrud This means that the ifft and fft algorithms are the same except that one multiplies by a kernel that's the complex conjugate of the other's, and that the scaling is off by a factor of N, N being the number of points. Some packages don't scale the fft and fix it all in the ifft. Some packages fix it all in the fft and don't scale the ifft. Some packages scale one by sqrt(N) and the other by sqrt(1/N). Your job is to figure out what your package does, and adjust your use of the FFT accordingly. -- Tim Wescott Control system and signal processing consulting www.wescottdesign.com
Hi all, 

As Tim Wescott rightly mentioned that an integer value of cycles are to be

taken for fft. I was not doing so and hence not getting sane values. 
Thanks Tim. 

I will pursue my work on Multi-band Amplitude compression in the frequency

domain. 

Regards,
AV.