how to take psd
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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?
0 commentaires
Réponses (2)
David Wilson
le 8 Avr 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!
0 commentaires
David Wilson
le 8 Avr 2019
If you want, the noise term will simply smudge the results.
0 commentaires
Voir également
Catégories
En savoir plus sur Spectral Estimation dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!