how to take psd

2 Ansichten (letzte 30 Tage)
Mohammed Al-Hasani
Mohammed Al-Hasani am 7 Apr. 2019
Beantwortet: David Wilson am 8 Apr. 2019
i want to take psd for following signal.
x=sin(2*pi*19000*t)+cos(2*pi*2000*t)+randn(size(t))+tan(2*f);
Can someone help me please?

Antworten (2)

David Wilson
David Wilson am 8 Apr. 2019
Bit hard to help since you haven't given us some key information, but assuming you are sampling at a reasonable sampling rate, and forthe moment we will drop the noise term, then
Ts = 1e-5; % sample time
Fs = 1/Ts; % sampling frequency
t = [0:Ts:0.001]';
f = 1000; % ??? (who knows?)
x=sin(2*pi*19000*t)+cos(2*pi*2000*t)+ 0*randn(size(t))+tan(2*f);
plot(t,x,'.-')
This will give a time plot ofthe signal. Always a good idea to look at that.
Now you were asked for a PSD, and typing
help psd
indicates we should use periodgram. Have a look at the help file, and you will see
periodogram(x,[],'twosided',512,Fs)
two clear peaks; one at 2 kHz and one at 19 kHz, just like in your original generating formula. What a coincidence!

David Wilson
David Wilson am 8 Apr. 2019
If you want, the noise term will simply smudge the results.

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by