DSPRelated.com
Forums

design a noise signal

Started by Laleh Mokhtarpour February 11, 2010
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 00;
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));
snr0;
k=awgn(v,snr);
Hp=spectrum.welch; Hp.segmentlength`0;
Hp.FFTlength='userdefined';
Pd=psd(Hp,k,'NFFT',3000,'Fs',Fs);

How should I find the correct value for nfft?
tnx
For :Laleh Mokhtarpour

We need to find the length of the signal first, so in your case it is


L=length(v);
N=2^nextpow2(L);
Gt(k,N);
F=Fs/2*linspace(0,1,N/2);
plot(F,abs(G(1:N/2)),'c')

OR

Hs=spectrum.welch;
psd(Hs,k,'Fs',Fs)

Hope that helps.
Farrukh