how to take psd
4 views (last 30 days)
Show older comments
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 Comments
Answers (2)
David Wilson
on 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!
0 Comments
See Also
Categories
Find more on Spectral Estimation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!