Plots for Problem 1.13 from Orfanidis
fmin = 0; fmax = 3; df = (fmax-fmin)/10000; f=fmin:df:fmax; a = 0.2; fo = 0.5; fs1 = 1; fs2 = 2; T1 = 1/fs1; T2 = 1/fs2; Xf2 = 1./(a^2 + ((2*pi*(f-fo)).^2)); T1Xhf2 = T1^2./(1-2*exp(-a*T1)*cos(2*pi*(f-fo)*T1)+exp(-2*a*T1)); T2Xhf2 = T2^2./(1-2*exp(-a*T2)*cos(2*pi*(f-fo)*T2)+exp(-2*a*T2)); figure(1) hold off plot(f,20*log10(Xf2)); hold on plot(f,20*log10(T1Xhf2),':'); plot(f,20*log10(T2Xhf2),'--'); axis([0 3 -30 30]) title('|X(f)|^2 and |T hat(X)(f)|^2') xlabel('f (Hz)') text(1.6,20,'fs = 1 Hz') text(2.,-20,'fs = 2 Hz') text(.7,-25,'Continuous') L1 = 10; T2XL1hf2=T2^2.*(1-2*exp(-a*T2*L1)*cos(2*pi*(f-fo)*T2*L1)+exp(-2*a*T2*L1))./ ... (1-2*exp(-a*T2 )*cos(2*pi*(f-fo)*T2 )+exp(-2*a*T2 )); figure(2) hold off plot(f,20*log10(Xf2),'--'); hold on plot(f,20*log10(T2Xhf2),':'); plot(f,20*log10(T2XL1hf2)); axis([0 3 -30 30]) title('|X(f)|^2, |T hat(X)(f)|^2 and |T hat(X)_L(f)|^2, L = 10') xlabel('f (Hz)') L2 = 20; T2XL2hf2=T2^2.*(1-2*exp(-a*T2*L2)*cos(2*pi*(f-fo)*T2*L2)+exp(-2*a*T2*L2))./ ... (1-2*exp(-a*T2 )*cos(2*pi*(f-fo)*T2 )+exp(-2*a*T2 )); figure(3) hold off plot(f,20*log10(Xf2),'--'); hold on plot(f,20*log10(T2Xhf2),':'); plot(f,20*log10(T2XL2hf2)); axis([0 3 -30 30]) title('|X(f)|^2, |T hat(X)(f)|^2 and |T hat(X)_L(f)|^2, L = 20') xlabel('f (Hz)')