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.

generating a noise signal

Status
Not open for further replies.

laleh_mokhtarpour

Newbie level 4
Newbie level 4
Joined
Feb 10, 2010
Messages
6
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
canada
Activity points
1,323
Hi
I want to design a narrow band singnal comprising frequencies of 100, 200, 300 and 400 Hz. it's variance is adjusted to 2, and a white noise with SNR of 30 db is added.
at the end I want to plot it's PSD, and my main problem is that I dont know how to use fft or how to set it's value
I wrot my matlab codes.
I am wondering if anybody could help me !?

Fs=2000;
t=0:1/Fs:1;
v=(cos(2*pi*100*t)+cos(2*pi*200*t)+cos(2*pi*300*t)+cos(2*pi*400*t));
snr=30;
k=awgn(v,snr);
Hp=spectrum.welch; Hp.segmentlength=600;
Hp.FFTlength='userdefined';
Pd=psd(Hp,k,'NFFT',3000,'Fs',Fs);

How should I find the correct value for nfft?
tnx
 

Hi
Tnx for your attention.
So in your opinion my code dosent work properly?
I wrote them from a thesis, and just changed the amount of nfft and segment length by trace and error.
my noise figure is similar to original but there is some variations
 

your signal is 2001 samples abut you are calculating the fft for 3000 samples. You are zero padding your data and therefore it might look slightly different.

It is good practice, when using the fft, to have a number of samples that is a power of 2.
 

mathuranathan said:
JoannesPaulus said:
It is good practice, when using the fft, to have a number of samples that is a power of 2.
As he says the NFFT length must be a power of 2 and should be close enough to the number of sample points in the data.

padding too much of zeros will make the spectrum different from the expected one.
Thank you for your support but your statement is not accurate:
NFFT length IS the number of samples and should be a power of 2, to avoid zero padding.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top