Homework 6 (a).m

# Homework 6 (a).m - %Mohamed Osman%Assignment 6%PART 1...

• Homework Help
• 2
• 100% (3) 3 out of 3 people found this document helpful

This preview shows pages 1–2. Sign up to view the full content.

%Mohamed Osman %Assignment 6 %PART 1 x=zeros(100,1); x(50)=1; d=0:0.01:5; b=[1 0.5] h=filter(b,1,x) figure(1) mag=abs(fft(h)) ; %Magnitude response phi=angle(fft(h)*(180/pi)) %phase response subplot(1,2,1) plot(db(mag)); xlim([0 50]) xlabel('Frequency') ylabel('magnitude (dB)') title('Magnitude response') subplot(1,2,2) plot(phi,'r'); xlim ([0 50]) xlabel('Frequency') ylabel('Phase (angle)') title('Phase response') %PART 2 f=10; t=0:0.01:1; x1=sin(2*pi*f*t) y=filter(h,1,x1) figure(2) plot(t,x1) hold on plot(t,y,'r') legend('Input Signal','Output Signal') xlabel('time (sec)') ylabel('Voltage') title('Signal vs. Filter') %PART 3 figure(3) mag1=abs(fft(y)) ; phi1=angle(fft(y)*(180/pi)) subplot(1,2,1) plot(db(mag1),'gr') xlabel('Frequency') ylabel('magnitude (dB)') title('Magnitude response after the input signal') subplot(1,2,2) plot(phi1), xlabel('Frequency') ylabel('Phase (angle)') title('Phase Response after the input signal') %PART 4 is in the second m file

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

This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: for i=10:1:20; % i is the frequency t7=0:0.01:1; x7=sin(2*pi*i*t7); y7=filter(h,1,x7); figure(4) plot(t7,x7) hold on plot(t7,y7,'r') legend('Input Signal','Output Signal') xlabel('time(sec)') ylabel('Amplitude') title('PART 4, Input Signal vs. Output Signal') mag7=abs(fft(y7)) phi7=angle(fft(y7)*(180/pi)) figure(5) subplot(1,2,1) plot(db(mag7)) xlabel('Frequency') ylabel('magnitude (dB)') title('Magnitude response of Part 4') subplot(1,2,2) plot(phi7,'r') xlabel('Frequency') ylabel('Phase (angle)') title('Phase Response of Part 4') end %PART 5 figure(6) y1=y+3.2*sin(2*pi*60*t) mag2=abs(fft(y1)) phi2=angle(fft(y1)*(180/pi)) subplot(1,2,1) plot(db(mag2),'r') xlabel('Frequency') ylabel('magnitude (dB)') title('Magnitude response for signal+10db noise') subplot(1,2,2) plot(phi2) xlabel('Frequency') ylabel('Phase (angle)') title('Phase Response for signal+(-10dB) Noise')...
View Full Document

• Spring '15
• magnitude response, Phase Response, ('frequency'), Mohamed Osman

{[ snackBarMessage ]}

### What students are saying

• 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.

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

• 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.

Dana University of Pennsylvania ‘17, Course Hero Intern

• 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.

Jill Tulane University ‘16, Course Hero Intern