Homework 6 (b, corrected).m - subplot(1,2,1...

Info icon This preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
% jnane Abdelhamid % homework#6 % Fall 2007 % BME 505 figure(1) T=2; l=0:5 b=exp(-l./T); subplot (2,2,1);plot(b);stem(b); xlabel ('h') ylabel('exp') title ('b function') x=zeros(100,1); x(10)=1; subplot (2,2,2);plot(x); title ('imput responde') b=filter(b,1,x); magh=abs(fft(b)); angleh=angle(fft(b)); subplot (2,2,3);plot (db(magh)) xlabel ('frequency(hz)') ylabel('magnetude(db)') title ('frequency domain response') subplot (2,2,4),plot(angleh,'g') xlabel ('frequency(hz)') ylabel('phase') title ('frequency domain response') %--------------------------------------% figure(2) fs=100 b=1; a=[1 -0.5]; x=zeros(100,1); x(10)=1; y=filter(b,a,x); subplot (2,2,1);plot([x y]);stem([x y]); xlabel ('X'); ylabel('Y'); title ('impulse response'); y=filter(b,a,x)% impulse respond subplot (2,2,2);plot(db(abs(fft(y))));xlim([0 51]); xlabel ('frequency(hz)'); ylabel('magnetude(db)'); title ('frequency domain response'); subplot (2,2,3);plot(angle(fft(y))/pi*180);xlim([0 51]); xlabel ('frequency(hz)'); ylabel('angle'); title ('frequency domain response'); %--------------------------------------- % question # 2, figure(3) t=0:0.01:1 f=5 x=sin(2*pi*f*t) y=filter(a,1,x) plot(t,x)
Image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
hold on plot(t,y) xlabel('time') ylabel('voltage') title(' filter affect on a 5 Hz signal') %question# 3 figure(4) magnit=abs(fft(y)) ; phase=angle(fft(y)*(180/pi))
Image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: subplot(1,2,1) plot(db(magnit),'r') xlabel('frequency') ylabel('magnitude') title('magnitude response after the input signal') subplot(1,2,2) plot(phase), xlabel('Frequency') ylabel('Phase (angle)') title('Phase Response after the input signal') %question # 4 figure(5) for i=10:1:30; % i is the frequency t=0:0.01:1; x1=sin(2*pi*i*t); y1=filter(y,1,x1); subplot(2,2,1);plot(t,x1) xlabel('time') ylabel('Amplitude') title(' Input Signal & Output Signal') subplot (2,2,2);plot(db(abs(fft(y1))));xlim([0 51]); xlabel ('frequency(hz)'); ylabel('magnetude(db)'); title ('frequency domain response'); subplot (2,2,3);plot(angle(fft(y1))/pi*180);xlim([0 51]); xlabel ('frequency(hz)'); ylabel('angle'); title ('frequency domain response'); y=filter(b,a,x) end %question #5 figure(6) t=0:0.01:1 f=5 x=sin(2*pi*f*t) y=filter(b,1,x); c=3 ynoise=y+c*sin(2*pi*100*t)% A=-10db subplot (2,2,1);plot(ynoise); subplot (2,2,2);plot(db(abs(fft(ynoise))));xlim([0 51]); xlabel ('frequency(hz)'); ylabel('magnetude(db)'); title ('Magnitude response for signal+10db noise'); subplot (2,2,3);plot(angle(fft(ynoise))/pi*180);xlim([0 51]); xlabel ('frequency(hz)'); ylabel('angle'); title ('frequency domain response');...
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