Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Unbelievable Precision Problem of Matlab's FFT

Status
Not open for further replies.

qslazio

Full Member level 3
Joined
May 23, 2004
Messages
175
Helped
18
Reputation
36
Reaction score
7
Trophy points
1,298
Activity points
1,420
a simple script segment to do FFT for a tone plus additive white noise.

nbpts = 32768;
fs = 1e3*nbpts;
nbprds = 7;
fi = fs/nbpts*nbprds;
amplitude = 1;
pnoise = 1e-6;

noise = random('norm',0,sqrt(pnoise),1,nbpts);
signal = amplitude*sin(2*pi*fi/fs*[0:nbpts-1]) + noise;

Sxx = abs(fft(signal)./nbpts).^2;
Snn = abs(fft(noise)./nbpts).^2;

Pn_wi_signal = sum(Sxx) - 0.5*amplitude^2
Pn_wo_signal = sum(Snn)

After running above script, you can seen that Pn_wi_signal is not equal to Pn_wo_signal. Pn_wo_signal is direct FFT to the noise itself.
Pn_wi_signal (varies a lot) is much larger than Pn_wo_signal which is right.

Anyone knows what's wrong with Pn_wi_signal?
Thanks a lot!
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top