about the value of PSD?

5 views (last 30 days)
qian xuewu
qian xuewu on 23 Jul 2015
when i computer the psd of signal,if i change sample frequency or the number of the signal,the result of the PSD is not the same value,why? my matlab code is as follows:
if true
when i computer the psd of signal,if i change sample frequency or the number of the signal,the result of the PSD is not the same value,why? my matlab code is as follows:
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)+3*sin(2*pi*35*t)+1.1*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,S1(1:N2),'r');
grid on,xlabel('frequency/Hz');ylabel('Amp^2/Hz');
title('PSD by FFT--fs=200Hz')
when the sample frequency is 200Hz, the figure is :
when the sample frequency fs turn to 400, the simulation result is :
my problem is: 1.when i change the fs or N, the value of psd is also changing,which is right? 2.if i want to get the units of PSD is v/sqrt(Hz),i indirect computer sqrt(value of psd(above result)),is right?

Answers (0)

Community Treasure Hunt

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

Start Hunting!