%Program Name: quiz.m % PURPOSE: To investigate the influence of delt on the psd % of a 2nd order underdamped system excited by white noise % ======================================================= % SPECIFY 2ND ORDER SYSTEM PARAMETERS zeta=0.01; %analog system damping ratio wn=10; %analog system undamped natural frequency Sxx=[]; delt=[]; % COMPUTE DIGITAL SYSTEM PSD FOR Wsamp = 10, 100 & 1000 times Wn for m=1:3 ws=wn*10^m; %sampling frequency vn=wn/ws; deltm=2*pi/ws; delt=[delt deltm]; alpha=exp(-2*pi*zeta*vn); beta=2*pi*vn*(1-zeta^2)^0.5; a1=alpha*sin(beta); b1=-2*alpha*cos(beta); b2=alpha^2; % COMPUTE PSD A=(deltm*abs(fft([0 a1],4096))).^2; A=A(1:2048); B=(abs(fft([1 b1 b2],4096))).^2; B=B(1:2048); Sxx=[Sxx ; 10*log10(A./B)]; end fvec=0:1/4096:0.5-1/4096; plot(fvec,Sxx) xlabel('Normalized Frequency (Hz)') ylabel('Sampled System PSD (dB') title('PSDs for ws=10, 100 and 1000 times wn')