EE450L Homework

3
PATEL PRADIPKUMAR RASIKLAL (13680) EE450L HOMEWORK 2 Answer 1) a) close all; clear all; a=[1 1 2]; b=[1 -1 0 1]; c=conv(a,b) b) den=1; num=[1 0 1 -1 1 2]; freqz(num,den); Answer 2 a) close all; clear all; y=0; t=0:.0001:5; for f=0:100 x=sin(2*pi*(4*f+1)*t); y=y+x; end plot(t,y); ylabel ('Amplitude'); xlabel ('Time Index'); TITLE ('Sine wave'); b)

description

homework

Transcript of EE450L Homework

Page 1: EE450L Homework

PATEL PRADIPKUMAR RASIKLAL (13680)

EE450L HOMEWORK 2

Answer 1)

a)

close all;clear all;a=[1 1 2];b=[1 -1 0 1];c=conv(a,b)

b)

den=1;num=[1 0 1 -1 1 2];freqz(num,den);

Answer 2

a)

close all;clear all;y=0;t=0:.0001:5;for f=0:100 x=sin(2*pi*(4*f+1)*t); y=y+x;endplot(t,y);ylabel ('Amplitude');xlabel ('Time Index');TITLE ('Sine wave');

b)

num=fir1(50,[0.1 0.9],'stop');freqz(num,1)

c)

close all;

Page 2: EE450L Homework

clear all;y=0;t=0:.0001:10;for f=0:100 x=sin(2*pi*(4*f+1)*t); y=y+x;end%plot(t,y);a=fft(y)% before passing through filtermag=abs(y);phx=angle(y)*180/pi;subplot(2,1,1);stem(mag);grid;subplot(2,1,2);stem(phx);grid;num=fir1(50,[0.1 0.9],'stop');z=freqz(num,1);b=fft(z)% after passing through filtermag1=abs(z);phx1=angle(z)*180/pi;subplot(4,1,3);stem(mag1);grid;subplot(4,1,4);stem(phx1);grid;ylabel ('Amplitude');xlabel ('Time Index');TITLE ('Sine wave');

d)

close all;clear all;y=0;t=0:.0001:10;for f=0:100 x=sin(2*pi*(4*f+1)*t); y=y+x;end%plot(t,y);a=fft(y)% before passing through filtermag=abs(y);phx=angle(y)*180/pi;subplot(2,1,1);stem(mag);grid;subplot(2,1,2);stem(phx);grid;num=fir1(50,[0.1 0.9],'stop');z=freqz(num,1);b=fft(z)% after passing through filtermag1=abs(z);phx1=angle(z)*180/pi;subplot(4,1,3);stem(mag1);grid;subplot(4,1,4);stem(phx1);grid;ylabel ('Amplitude');xlabel ('Time Index');TITLE ('Sine wave');freq(b)% frequency responce of filter after passing through filter