ex5_4 - % % compute y(t) c0 = .5; H0 = 1; N = 50; y =

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
% Example 5.4 t = -3:6/800:3; w0 = pi; k=1:50; % first plot the amplitude spectrum for x and for y ckx = sin(k*pi/2)./k/pi; ckx = [ckx(length(ckx):-1:1), .5, ckx]; k = -50:50; clf subplot(211),stem(k*pi,abs(ckx)); axis([-80 80 0 .5]) xlabel('Frequency (rad/sec)') ylabel('|ckx|') RC = input('Input value of RC: '); H = (1/RC)./(j*k*w0 + 1/RC); cky = ckx.*H; subplot(212),stem(k*pi,abs(cky)); xlabel('Frequency (rad/sec)') ylabel('|cky|') axis([-80 80 0 .5]) pause clf
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: % % compute y(t) c0 = .5; H0 = 1; N = 50; y = c0*H0*ones(1,length(t)); counter = 0; for k=1:2:N, if counter == 0, ck = 1/k/pi; counter = 1; else ck = -1/k/pi; counter = 0; end H = (1/RC)/(j*k*w0 + 1/RC); y = y + ck*H*exp(j*k*w0*t) + ck*conj(H)*exp(-j*k*w0*t); % note ck is real end clf subplot(211),plot(t,y) title(['Example 5.4 RC = ' num2str(RC)]) xlabel('Time (sec)') ylabel('y(t)') axis([-3 3 -.5 1.5]) subplot(111)...
View Full Document

This note was uploaded on 03/24/2010 for the course CENG 4331 taught by Professor Maryrandolph-gips during the Fall '09 term at UH Clear Lake.

Ask a homework question - tutors are online