how to computer the certain signal's PSD?
1 view (last 30 days)
Show older comments
if true%%
if i want to computer the psd of the simulation signal by matlab,how to do,the program as follows,please tell me where wrong is
%%%%
clear all;
close all
fs=200;%sample frequency
N=2^10;%sample number
t=[0:N-1]*1/fs;%time
%DC+frequency signal+noise
xn=1+5*sin(2*pi*10*t)+3*sin(2*pi*15*t)+3*sin(2*pi*20*t)+3*sin(2*pi*25*t)+3*sin(2*pi*30*t)+1.0*randn(1,N);
N2=floor(N/2);
%computer PSD
Xk=fft(xn,N);
S1=abs(Xk).^2/N/fs;S1(2:end)=S1(2:end)*2;
semilogy([0:N2-1]*fs/N,sqrt(S1(1:N2)),'b');
grid on,xlabel('frequency/Hz');ylabel({'$${Amp/}\sqrt{Hz}$$'},'interpreter','latex');
title('PSD by FFT')
problem is:
1.if i want to get the unit is Amp/sqrt(Hz),sqrt(Amp^2/Hz)is right?
2.the input signal's harmonic 15Hz,20Hz,25Hz,30Hz Amp is all equal to 3,however,the PSD's output'Amp of signal's corresponding frequency is not equal,why?
3. if my methord is not right,how to do? thank you!
0 Comments
Answers (0)
See Also
Categories
Find more on Parametric 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!