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

Info icon This 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
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

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern