Program no 1

WAP to generate a random noise of amplitude 0.5 Vpp, add it to a generated low frequency signal of 200 Hz and pass it through an LPF of 300 Hz and FS1 and compare the filtered o/p with the original signal to see if noise is reduced. clc clear close all %SPECIFICATION samp= 2000; fp= 300; fs=400; ap=.5; as=50; wp=ap/(samp/2); ws=as/(samp/2); [n,Wn]=buttord(wp,ws,ap,as);%ORDER & CUTOFF CALCULATION [b,a]=butter(n,Wn,'low');%COEFFICIENT CALCULATION [h,o]=freqz(b,a,256);%FREQUENCY RESPONSE plot(o/pi, 20*log10(abs(h)));%PLOT IMPULSE RESPONSE xlabel('n'); ylabel('dB'); title('impulse response'); %LOW FREQ SIGNAL GENERATE n=0:1/samp:1; x=cos(2*pi*200*n); %RANDOM SIGNAL GENERATE m=2001; d=rand(1,m)-.5; %I/P GENERATE p=x+d; y=filter(b,a,p); %PLOT THE I/P & O/P OF THE FILTER IN FREQ DOMAIN figure subplot 211,plot (abs(fft(p))); xlabel('freq(hz)'); ylabel('amplitude X(f)'); title('i/p in freq domain'); subplot 212,plot (abs(fft(y))); xlabel('freq(hz)'); ylabel('amplitude X(f)'); title('o/p in freq domain'); %PLOT THE I/P & O/P OF THE FILTER IN TIME DOMAIN figure subplot 211,plot (n,p); xlabel('time');

ylabel('amplitude x(t)'); title('i/p to filter in time domain'); subplot 212, plot (n,y); xlabel('time'); ylabel('amplitude x(t)'); title('filtered o/p in time domain');

Fig1: impulse response of LPF

Fig2: comparison of i/p & o/p in freq domain.

Fig3: comparison of i/p & o/p in time domain. Prithwiraj Sinha DE/11/EC/01

PROGRAM no 2
WAP to generate a sinusoidal signal consisting of %frequencies 300Hz,600Hz and 1200Hz with FS2 and pass it through any LTI %system H(z) and compare the time and frequency domain input and output. clc clear clear all %specification %FS2=5000Hz=samp %H(z)={num=[1,3,2];den=[1,-0.1,o.5]} samp=5000; n=0:1/samp:1; x=cos(2*pi*300*n)+cos(2*pi*600*n)+cos(2*pi*1200*n);%x=input num=[1 3 2]; den=[1 -0.1 0.5]; y=filter(num,den,x);%y=output figure subplot 211, plot(n(1:100),x(1:100)); title('input in Time Domain'); subplot 212, plot(n(1:100),y(1:100)); title('output in Time Domain'); figure subplot 211, plot(n,abs(fft(x))) title('input in Frequency Domain'); subplot 212, plot(n, abs(fft(y))) title('output in Frequency Domain');

Submitted by:Debajyoti Deb (DE/11/EC/002)

Q3. WAP to generate a sinusoidal signal consisting of frequencies 100Hz, 200Hz
and 1000Hz with FS1 and pass it through a system H(z) which is cascade combination of two LTI systems H1(z) and H2(z) with zero initial condition and prove the output is same even if u change the order of H1(z) and H2(z) in the cascade connection.
clc; clear; close all; samp=2000;%FS1 n=0:1/samp:1; %input signal x=cos(2*pi*100*n)+cos(2*pi*200*n)+cos(2*pi*1000*n); H1num=[2.24 2.49 2.24]; H1den=[1 -0.4 0.75]; ic=[0,0]; y1=filter(H1num,H1den,x,ic); H2num=[1,2,0.24]; H2den=[1,0.9,1]; y2=filter(H2num,H2den,y1,ic); figure subplot 121, plot(n,abs(fft(x))) %now changing the order of H1(z) and H2(z) in the cascade connection. y3=filter(H2num,H2den,x,ic); y4=filter(H1num,H1den,y3,ic); figure subplot 221, plot(n, abs(fft(y2))) subplot 222, plot(n, abs(fft(y4)))

Result

Done by – Surya Vaydunth(DE/11/EC/03) .

4.% difference between actual o/p & expected o/p if abs(sum(sum(d)))<10^(-3) % H1(z)& H2(z) in cascade is linear since for x1:z1. 0.% output of H1(z) when x1 is input y2=filter(num1. -0.9.ic).x. -0. 2. 0.% output of H1(z) when x2 is input y=filter(num1.% output of H2(z) when y1 is input z2=filter(num2.den2. 0. 1].ic). 2.y1.PROGRAM TO SHOW THAT H1(z) & H2(z) IN CASCADE IS LTI SYSTEM % H1(z)={num1=[2.den2.1.75 ].zt).24]. stem(n. y1=filter(num1.% output of H2(z) when y2 is input z=filter(num2.2).49. % x is input to H1(z) such that x=a*x1+b*x2 ic=[0 0].y.ic). b=-3. den2=[1.den1.yd. x2:z2.D=5.% output of H2(z) when yd is input t=z-zd(1+D:41+D).den1. den2=[1.24. 2. z1=filter(num2.24].x2. grid subplot(3. % a*x1+b*x2:a*z1+b*z2 % to check whether H1(z) & H2(z) in cascade is time invariant xd=[zeros(1.xd.ic). 2.% output of H1(z) when x is input num2=[1. stem(n.den1. x=a*x1+b*x2.z).% delayed signal x yd=filter(num1. if abs(sum(sum(t)))<10^(-3) disp('H1(z) and H2(z) in cascade is LTI system') else disp('H1(z) and H2(z) in cascade is not LTI system') end else disp('H1(z) and H2(z) in cascade is not LTI system') end % to show the linearity of the cascaded system subplot(3.% output of H1(z) when xd is input zd=filter(num2.ic).% output of H2(z) when y is input zt=a*z1+b*z2. 2.d).1).y2. clc. stem(n. grid subplot(3.1*n).ic).24].den2.ic).24.ic).49. 0.4*n). % x1 & x2 are inputs to H1(z) x2=cos(2*pi*0. close all n=0:40.den1. % initially relaxed % to check whether H1(z)& H2(z) in cascade is linear num1=[2.D) x].4. 2. -0.% expected output for the system to be linear d=z-zt. % a & b are arbitrary constants & D is delay x1=cos(2*pi*0. den1=[1. a=2.9. 1]} clear all.4.1.1. -0.3).24].75 ]} % H2(z)={num2=[1. grid . den1=[1.x1.den2.

grid subplot(3.1.2). stem(z).% to show time invariance of the cascaded system figure subplot(3. grid OUTPUT.3).H1(z) and H2(z) in cascade is LTI system original output 200 z 0 -200 0 5 10 15 20 25 n expected output 30 35 40 200 zt 0 -200 0 x 10 -13 5 10 15 20 n difference 25 30 35 40 1 d 0 -1 0 5 10 15 20 n 25 30 35 40 Graph1-To show linearity of the system .1. stem(t). stem(zd).1. grid subplot(3.1).

original output 200 zt 0 -200 0 5 10 15 20 25 30 35 40 45 delayed output 200 zd 0 -200 0 5 10 15 20 25 difference 1 0 -1 0 5 10 15 20 n 25 30 35 40 45 t 30 35 40 45 50 Graph2.To show time invariance of the system NAME-SHREYASEE DEBNATH ROLL NO. DE/11/EC/004 .

2). subplot(3.1).% initially not relaxed y1=filter(num1. if abs(sum1)>10^6. den=[1 -0.den1. p=0. title ('diffrence between original and delayed o/p') if abs(sum(sum(d)))<10^(-3) disp('LTI SYSTEM IS TIME-SHIFT INVARIANT') else disp('LTI SYSTEM IS TIME-SHIFT VARIANT') end %STABILITY PROPERTY h1=impz(num1. d=y-yd(1+D:41+D). else .grid.den1. ic=[0 0].y1.1*n)-2*cos(2*pi*0.% initially relaxed %ic=[0 2].grid.4 0. clc. for k=1:N+1 sum1=sum1+h1(k). den1=[1 -0. %TIME INVARIANCE PROPERTY N=40.yd1.1. title('original o/p'). subplot(3.xd.stem(d).grid.ic).5].3). Program:clear all.N+1). sum1=0. num=[1 3 2].ic). title('delayed o/p'). yd=filter(num.49 2.stem(yd).4*n). yd1=filter(num1. xd=[zeros(1. y=filter(num.75].1 0. n=0:N.24].den.24 2.stem(y). x=3*cos(2*pi*0. num1=[2. close all.den.1.ic).Program no 5 WAP to check whether a given system H1(z) and H(z) in cascade is stable and time invariant.x.1. subplot(3.ic). D=10.D) x].den1.

den. end end h=impz(num. sum=0. end end if (p+q)==2 disp('LTI SYSTEM IS STABLE') else disp('LTI SYSTEM IS UNSTABLE') end figure stem(n. for k=1:N+1 sum=sum+h(k).grid. n=0:N. else q=1.N+1). if abs(sum)>10^6. disp(sum) .p=1. disp('Total Sum of impulses ='). title ('stability check'). q=0.h).

Fig1: checking the time invariance property (original output. Fig 2: showing the stability property of the system. -ASHUTOSH (DE/11/EC/05) . delayed output and the difference between the two).

clear all. grid. disp('total sum of impulse='). clc. h1=impz(num1. n=0:N. for k=1:N+1 sum1=sum1+h1(k).75].5]. q=0. for k=1:N+1 sum=sum+h(k).24]. end figure stem(n. sum=0. den=[1 -.den1.N+1). end end if (p+q)==2.h). else p=1. . end end h=impz(num. else disp('LTI system is unstable').N+1). if abs(sum)>10^6.4 . close all. if abs(sum1)>10^6 p=0.24 2. else q=1. den1=[1 -0. sum1=0.Program no: 6 WAP to check whether a given system H1(z)and H2(z)in cascade is stable and follows the superposition theorem. N=40.49 2. %stability property num1=[2.1 . num=[1 3 2]. title('stability check'). disp('LTI system is stable').den.

y1. disp('SYSTEM H1(Z) IS NON-LINEAR') end subplot 121.ic).den. y22=filter(num. yf=a*y11+b*y22.ic). disp('SYSTEM H1(Z) IS LINEAR') else m=1. d=y-yt.abs(d)). stem(n. disp('cascade doesnt follow superposition') end if m+no==1. disp('cascade doesnt follow superposition') else disp('cascade follow superposition') end .ic). disp('SYSTEM H2(Z) IS NON-LINEAR') end subplot 122. x=a*x1+b*x2.x.ic). if abs(sum(sum(d)))<10^(-3).ic).x1. yt=a*y1+b*y2.x2. %%%%%2nd system y11=filter(num.y2.den1. x1=cos(2*pi*0. if abs(sum(sum(d1)))<10^(-3). yf1=filter(num.4*n). d1=yt-yf.den1. ic=[0 0].% initially relaxed %ic=[0 2]. m=0. x2=cos(2*pi*0. %superposition check a=2.den. if m+no==2.% initially not relaxed %1st system y1=filter(num1. disp('SYSTEM H2(Z) IS LINEAR') else no=1. y=filter(num1.abs(d1)).den. stem(n. b=-3. no=0. y2=filter(num1.1*n).disp(sum).den1.yt).

.Fig 1: showing the stability property of the system.

Fig: 2 showing superposing property RANDHEER KUMAR RAVI DE/11/EC/06 Program no 7 :.WAP to calculate the convolution output of x9n0=[1 2 3 4 -1 -2 -3 0 1 2 0 -1 0 4 3 using overlap-add method with .

% points are overlapping xk=[xp z].h. stem(yy) title('Using LONG linear filtering') %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % overlap add method Nx=length(x). y=zeros(K+1. subplot 311. %size of DFT is computed x=[x zeros(1. %length of impulse response sequence is computed M1=M-1. % L-R zeros are appended to input sequence h=[h zeros(1. % produces zero matrix z=zeros(1. close all. Program:clc. %input signal h=[1 0 -1]. % produces zero matrix %dividing to K blocks for k=0:K xp=x(L*k+1:L*k+L). % Remainder(R) is calculated by dividing length of input N=L+M1.L-R)]. %impulse response L=4. %overlapping points R=rem(Nx. %circular convolution of input signal and response end yp=y'.M1).N). % zeroes are padded y(k+1. %length of each block %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% yy=conv(x.:)=cconv(xk.h(n)=[1 0 -1] without using the inbuilt commands and compare the result with the output of the ‘conv’ command. x=[1 2 3 4 -1 -2 -3 0 1 2 0 -1 0 4 3]. %transpose of yp .N). %length of input sequence is computed M=length(h).h).L).N-M)]. % N-M zeros are appended to the impulse response sequence K=floor(Nx/L). clear all.

y]=size(yp). % incrementing the counter end end end y=ypnew. % used in the for loop yp(temp1. stem(d) title('Difference') . subplot 313.temp2)=temp3. stem(y) title('Using Overlap Add method') d=yy-y(1:length(yy)). % determining the size of array for i=L+1:x. % storing the value of ypnew in y subplot 312.[x.j). %to store the values in one Dimensional array z=z+1. end end z=1. for j=1:y-1 temp1=i-L. % setting counter z=1 for j=1:y for i=1:x if ((i<=L & j<=y-1)|(j==y)) ypnew(z)=yp(i. temp3=yp(temp1.j). temp2=j+1.temp2)+yp(i.

Using LONG linear filtering 10 0 -10 0 2 4 6 8 10 12 14 16 18 Using Overlap Add method 10 0 -10 0 x 10 -15 2 4 6 8 10 12 14 16 18 Difference 2 0 -2 0 2 4 6 8 10 12 14 16 18 Submitted by:Danish Khan DE/11/EC/007 .

clc clear all close all %overlap save method of convolution x=[1 2 3 4 -1 -2 -3 0 1 2 0 -1 0 4 3].N). %circular convolution %function [c]=dcconv(a.N) %A=fft(a.%produces zero matrix of the order 9X4 for k=0:K xk=x(k*L+1:k*L+N).N). %C=A.%N-M zeros are appended to the impulse %response sequence K=floor((Nx+M1-1)/L).%the last column of matrix is stored in Y y=(Y(:))'%output through overlap save y2=conv(x. zeros(1.:)=dcconv(xk.%M-1 zeros are appended to i/p h=[h zeros(1.%length of impulse response id calculated %calculated M1=M-1.N). %B=fft(b.M-1).%length of i/p sequence is calculated M=length(h). x.%number of points in each block is calculated x=[zeros(1.%inmpulse response N=3.b.N).%input signal h=[-1 0 1].2:3… Y(k+1.h.*B.%points are overlapping as in 1:2.%circular convolution of input signal & response end Y=Y(:.%length of filter Nx=length(x).M:N).PROGRAM:8 WAP to calculate the convolution output of x(n)=[1 2 3 4 -1 -2 -3 0 1 2 0 -1 0 4 3] %%using overlap-save method with h(n)=[1 0 -1] without using the inbuilt commands %%and compare the result with the output of the ‘conv’ command.%overlapping points L=N-M1. %c=ifft(C.N-M)].h)%using 'conv' command OUTPUT: .N-1)].%decimal adjustment y=zeros(K+1.N).

0000 -2.0000 -4.y= Columns 1 through 11 -1.0000 -2.0000 3.0000 -2.0000 4.0000 2.0000 Columns 20 through 21 0 0 Submitted by:Swagata das DE/11/EC/008 .0000 y2 = Columns 1 through 19 0 0 -1 -2 -2 -2 4 6 2 -2 -4 -2 1 3 0 -5 -3 4 3 0 -5.0000 -2.0000 -2.0000 6.0000 Columns 12 through 17 3.0000 1.0000 4.0000 -3.

matrix is stored in Y %input signal %impulse response %length of filter %legth of input %length of impulse %overlapping points %number of points in % M-1 zeros are % N-M zeros are %decimal adjustment.M-1).N).2:3… Y(k+1. for k=0:K xk=x(k*L+1:k*L+N). % produces zero %points are %circular %the last column of . L=N-M1.M:N). appended to the impulse response sequence K=floor((Nx+M1-1)/L).N). N=2. Nx=length(x). each block is computed x=[zeros(1. %C=A.N) %A=fft(a. overlapping as in 1:2. %(Designed by Dipyaman Modak (DE/11/EC/09)] %circular convolution %function [c]=dcconv(a. matrix of the order 9X4. h=[-1 1].N-1)].Program no 9 %WAP to calculate the convolution output of %x(n)=[1 2 3 4 -1 -2 -3 0 1 2 0 -1 0 4 3] using overlapsave method with h(n)=[ 1 -1] without using the inbuilt commands and compare the result with the output of the overlap-add output of the same.N-M)].h.:)=dcconv(xk. %B=fft(b. %c=ifft(C.b. zeros(1. convolution of input signal & response end Y=Y(:. response sequence is computed M1=M-1. clc clear all close all %overlap save method x=[1 2 3 4 -1 -2 -3 0 1 2 0 -1 0 4 3]. y=zeros(K+1.*B.N).N). sequence is computed M=length(h). x.N). appended to input sequence h=[h zeros(1.

%impulse response L1=2.temp2)=temp3. %produces zero matrix z1=zeros(1.L1). %length of filter Nx1=length(x1). %transpose of yp [x1. %circular convolution of input signal and response end yp1=y1'.N1-M1)]. %overlapping points N1=L1+M2. %three variables are used to store temp2=j+1.y1]=size(yp1).N1). end end . % Remainder(R) is calculated by dividing length of input % sequence(Nx) by the length of response(L) x1=[x1 zeros(1.N1).L1-R1)].yoverlap=(Y(:))' %transpose of y -------------------------------------------------------------------------------------------------------------------------------------------------------------------------x1=[1 2 3 4 -1 -2 -3 0 1 2 0 -1 0 4 3]. %legth of input sequence is computed M1=length(h1). %input signal h1=[-1 1].M2). %length of impulse response sequence is computed M2=M1-1.:)=dcconv(xk1. % L-R zeros are appended to input sequence h1=[h1 zeros(1. % N-M zeros are appended to the impulse response sequence K1=floor((Nx1)/L1). for j=1:y1-1 temp1=i-L1. %produces zero matrix for k1=0:K1 xp1=x1(L1*k1+1:L1*k1+L1).j). %decimal adjustment y1=zeros(K1+1.temp2)+yp1(i. % determining the size of array for i=L1+1:x1.%in the for loop yp1(temp1. %the result obtained temp3=yp1(temp1. %zeroes are padded y1(k1+1. % points are overlapping xk1=[xp1 z1]. %size of DFT is computed R1=rem(Nx1.h1.

0000 -1.0000 3. %to store the values in one Dimensional array z=z+1.0000 1.j).0000 -3.0000 -1.0000 5.z=1.0000 2. % incrementing the counter end end end yoverlapadd=ypnew % storing the value of ypnew in y %y convolution output yoverlapsave = -1 2 -1 1 -1 -1 -1 -4 1 5 3 1 1 -3 -1 -1 yoverlapadd = Columns 1 through 11 -1.0000 Columns 12 through 17 1.0000 -4.0000 -1. for i=1:x1 if ((i<=L1 && j<=y1-1)||(j==y1)) ypnew(z)=yp1(i.0000 0 Submitted byDipyaman Modak.0000 1. % setting counter z=1 for j=1:y1.0000 -1.0000 -1.0000 1. DE/11/ECE/09 .0000 -1.

[c.5dB and As=50dB. subplot 223.a. [H.Program no 11 %WAP to design a LPF of same specifications being IIRB and IIRC-II %type and compare their outputs in time domain when a signal lying %in transition band is passed through them with Ap=0. fp=500.as). [M.abs(fft(x))) y1=filter(b.wm).ws. Clc.d]=cheby2(M.ap.ws. [N.a]=butter(N.plot(X/(2*pi). ap=. Clear.as.x). plot(n. [b. samp=2000.wn]=buttord(wp. plot(n.as).a. as=50. [I. x=cos(2*pi*200*n)+cos(2*pi*700*n). figure subplot 221.wm]=cheb2ord(wp.20*log10(abs(H))) subplot 122. subplot 121.X]=freqz(c.x).abs(fft(y2))) . fs=600. wp=fp/(samp/2).d. ws=fs/(samp/2).5.ap.20*log10(abs(I))) n=0:1/samp:1. subplot 222.W]=freqz(b. plot(n.abs(fft(y1))) y2=filter(c.256). Close all.d.256).plot(W/(2*pi).wn).

FIGURE 1: .

: DE/11/EC/11 .FIGURE 2: SUBMITTED BY: Mahashweta dey ROLL NO.

subplot 222.abs(fft(y2))) . plot(n.'stop'). % determining order and natural frequency [b. x=cos(2*pi*200*n)+cos(2*pi*500*n)+cos(2*pi*800*n).Program no 12 %%WAP to design a BSF of same specifications being IIRC-I and IIRE type and %%compare their outputs in time domain when a signal lying in transition band %%is passed through them with Ap=0. [H.a. plot(n.ws.ap.plot(X/(2*pi).abs(fft(y1))) subplot 223. figure subplot 221.x).256).%stopband frequency fs2=600. subplot 121.256). subplot 122.%passband frequency samp=2000. %chebyshev-I [N.a]=cheby1(N.%stopband frequency fp2=700.ap.as). plot(n.ws.as).20*log10(abs(I)))%plots the frequency response curve n=0:1/samp:1. as.d.a. % determining order and natural frequency [c.wn]=cheb1ord(wp.wm]=ellipord(wp.plot(W/(2*pi). fp1=300. [I.%cutoff frequency ws=[fs1 fs2]/(samp/2).wm.%stopband ripples wp=[fp1 fp2]/(samp/2).ap.W]=freqz(b.5dB and As=60dB.wn.ap.d.X]=freqz(c.%passband frequency fs1=400.abs(fft(x))) y1=filter(b.d]=ellip(M.20*log10(abs(H)))%%plots the frequency response curve %ellipord [M.5.%passband ripples as=60.x).%sampling frequency ap=.'stop'). y2=filter(c.

Submitted byShruti Roychoudhary DE/11/EC/12 Problem number 13 .

%passband frequency Fs=300. %specification: samp=2000.As).256).Wn2.xlabel('discrete time'). [H2.plot(n(1:500).a2]=cheby1(N2.clear all.a1]=cheby1(N1. title('frequency response of chebyshevI filter').Ap. %comparison of the outputs of two filters figure plot(n(1:500).title('output in time domain of IIR C II').Wn1. %coefficient calculation [H1.As). X=cos(2*pi*n*350)+cos(2*pi*n*380).title('time domain comparision of outputs of IIR CI and IIR CII').7dB and As=50dB.%Input signal Y=filter(b1.%time domain comparision of outputs of IIR CI and IIR CII xlabel('discrete time').%sampling frequency Fp=400.a1. subplot 312.ylabel('Z'). plot(W1/2*pi.a2.Z(1:500)).ylabel('gain in dB'). %stop band attenuation Wp=Fp/(samp/2).plot(n(1:500).a2.W1]=freqz(b1.%13.xlabel('phase angle').ylabel('Y').Wn2]=cheb1ord(Wp. %check for output from each of the filter for the same input lying in the transition band.256). subplot 313.close all. %pass band attenuation As=50.n(1:500). %order and natural frequency calculation [b1.ylabel('X').%output from IIR chebychevI Z=filter(b2.20*log10(abs(H2))).X).title('frequency response of IIR CII'). %Solution: clc. . %passband edge frequency(normalized) Ws=Fs/(samp/2).7.Ws.Y(1:500).ylabel('Y and Z'). subplot 212.Ap. n=0:1/samp:1.a1. %stopband frequency Ap=0.%output from IIR chebychevII figure subplot 311.xlabel('discrete time'). title('frequency response of chebyshevII filter').xlabel('discrete time').plot(n(1:500).title('input in time domain'). %stopband edge frequency(normalized) %Design of chebyshevI filter [N1. plot(W2/2*pi.'high').W2]=freqz(b2.Y(1:500)).WAP to design a HPF of same specifications being IIR-CI and IIRC-II type %and compare their outputs in time domain when a signal lying in transition %band is passed through them with Ap=0.X). %frequency response calculation subplot 211.ylabel('gain in dB').xlabel('phase angle').20*log10(abs(H1))).Ap. %Design of chebyshevII filter [N2.X(1:500)).Ap.'high').Ws.Z(1:500)). [b2.title('output in time domain of IIR C I').Wn1]=cheb1ord(Wp.title('frequency response Oof IIR CI').

5 3 pa ag h se n le fre u n re o seo ch b e II filte q e cy sp n f e ysh v r 1 .25 1 Z 0 -1 0 0.15 discrete time output in time domain of IIR C I 0.fre u n re o seo ch b e I filte q e cy sp n f e ysh v r 0 gain in dB -1 0 0 -2 0 0 -3 0 0 -4 0 0 0 0 .25 .5 4 4 .2 0.5 5 0 gain in dB -1 0 0 -2 0 0 -3 0 0 -4 0 0 0 0 .5 5 input in time domain 2 X 0 -2 0 0.1 0.5 4 4 .1 0.05 0.2 0.15 discrete time output in time domain of IIR C II 0.25 1 Y 0 -1 0 0.5 2 3 .2 0.5 2 2 .5 1 1 .15 discrete time 0.05 0.1 0.5 1 2 .05 0.5 pa ag h se n le 3 3 .

4 -0.25 Submitted by: Manish Sharma (DE/11/EC/13) .1 0.05 0.4 0.2 Y and Z 0 -0.15 discrete time 0.time domain comparision of outputs of IIR CI and IIR CII 0.2 -0.6 -0.6 0.2 0.8 0 0.

20*log10(abs(H2))).a2.a2]=cheby2(N2.plot(n.as).%stop band attenuation wp=[fp1 fp2]/(samp/2).x). y1=filter(b1.a1. %specification: samp=2000.wn1]=buttord(wp. subplot 313.close all.%order and cutoff calculation [b1.%pass band attenuation as=80.xlabel('phase angle').WAP to design a BPF of same specifications being IIRB and IIRCII type %and compare their outputs in time domain when a signal lying in transition band is passed through them with Ap and As.y1).5.ws.y2). clc.clear all.%coefficient calculation [H2.title('input in time domain').as. fs1=300.wn2]=cheb2ord(wp.xlabel('discrete time'). ws=[fs1 fs2]/(samp/2).ylabel('y1').%coefficient calculation [H1.'bandpass').ylabel('gain in dB').a2. %iir butterworth design: [N1.%frequency responce figure subplot 211.as). plot(W2/2*pi.wn2.%order and cutoff calculation [b2.plot(n. subplot 312.xlabel('phase angle'). %testing: n=0:1/samp:0. y2=filter(b2.ap.20*log10(abs(H1))).x). ap=0.%sampling frequency %band-edges: fp1=400.plot(n.title('output in time domain of IIR B'). fp2=700.a1]=butter(N1. plot(W1/2*pi. fs2=800.x). subplot 212.PROGRAM NO 14 .256).xlabel('discrete time').title('frequency response of IIR CII').title('frequency response Oof IIR B').wn1.W1]=freqz(b1.a1.ylabel('x').ws.ylabel('gain in dB').xlabel('discrete time').1.'bandpass').ap. figure subplot 311.ylabel('y2'). figure .title('output in time domain of IIR CII').%frequency responce %iir chebyshev2 design: [N2. x=cos(2*pi*350*n)+cos(2*pi*750*n).W2]=freqz(b2.256).

ylabel('y1 and y2'). .title('time domain comparision of outputs of IIR B and IIR CII').plot(n. Submitted by:RAKESH YADAV DE/11/EC/14 PROGRAM NO 15 :WAP to design a BPF of same specifications being hamming FIR-W and IIRE type and compare their outputs in time domain when a signal lying in transition band is passed through them with Ap=0.n.y2).%time domain comparision of outputs of IIR B and IIR CII xlabel('discrete time').7dB and As=50dB.y1.

subplot 221. subplot 133. 20*log10(abs(H))). fs1=sampling frequency wp1=fp1/fn. b = fir1(L. Wp.Ws. %passband frequency fp2=600. % elliptical .as).d]=ellip(N.abs(fft(x))) subplot 222. n=0:1/samp:1. plot(1:L+1.wn. %Filter length fp1=400.256).X]=freqz(b. subplot 223.4.abs(fft(y2))) . figure y1=filter(b. plot(X/pi.wn]=ellipord(Wp.L+1).x). Ws=[fs1 fs2]/(samp/2).d.W2=. Wp=[wp1 wp2].X]=freqz(c. [I.256). fs2=700. L=66. subplot 132.BPF of pass 400-600Hz fs1=300.plot(X/(2*pi). % Normalized cut off frequencies.Solution: samp=2000.ap.1.1.d.'bandpass'). %stopband freq fn=samp/2.w). ap=. [H.7.ap. W1=. plot(n. % Nyquist frequency. [c. [N.6 w=window(@hamming. as=50. plot(n.20*log10(abs(I))) x=cos(2*pi*200*n)+cos(2*pi*500*n)+cos(2*pi*800*n).x). 'bandpass'.as. plot(abs(fft(y1))) y2=filter(c. %hamming window subplot 131. wp2=fp2/fn.w).

Subplot 131:Graph represent Hamming Windows Subplot 132:Impulse response of hamming FIR-W .

Subplot 133:Impulse response of IIRE bandpass SUBPLOT 131: Graph representation of fft(x) .

SUBPLOT 132: Graph representation of fft(y1) SUBPLOT 133: Graph representation of fft(y2) Sunil Kumar (DE/11/EC/15) .

[h. [1 0 1].256). filtype.Program no 16 WAP to design a BSF of same specifications being FIRPM and Kaiser FIR-W type and compare their outputs in time domain when a signal lying in transition band is passed through them with Ap=0. [n.bta).1. . b = firpm(n.w] = firpmord( [300 400 550 650]. n=0:1/samp:1.O]=freqz(b1. kaiser(N1+1.1. [dp ds dp].o]=freqz(b. title 'FIRM' y=filter(b.1. plot(1:N1+1. W1.bta).W1.x).mo. samp ).filtype] = kaiserord( [300 400 550 650].fo. [1 0 1].N1+1. 'noscale'). ds=10^(-as/20). 20*log10(abs(h))). [dp ds dp].w1).256). b1 = fir1(N1. figure subplot 121.6dB and As=40dB.%as=-20*log10(ds) dp=1-10^(-ap/20). [H. figure plot(o/pi.6.w).mo. clc clear close all samp=2000. x=cos(2*pi*350*n)+cos(2*pi*600*n).%ap=-20*log10(1-dp) as=40. [N1. w1 = window(@kaiser.fo.bta. ap=0. samp ).

title 'FIRPM output' subplot 313. y1=filter(b1. plot(abs(fft(y1))). title 'kaiser window' figure subplot 311. title 'input signal' subplot 312. title 'kaiser output' Dayananda Rajkumar Roll no.subplot 122. 20*log10(abs(H))). plot(O/pi. plot(abs(fft(y))).1. plot(abs(fft(x))). DE/11/EC/16 .x).

3.8dB and As=80dB.mo. samp=2000.1. plot(abs(fft(y1))). 'low'. [h.x)..fo.8.. I=.. y2=filter(c.. % hanning FIR-W L=66. ap=0. subplot 133.. b = firpm(n.L+1). subplot 223.. I. 20*log10(abs(H))).w). figure subplot 132. . ds=10^(-as/20).256). plot(abs(fft(y2))). plot(X/pi. plot(1:L+1.x).%as=-20*log10(ds) dp=1-10^(-ap/20).... samp )... x=cos(2*pi*100*n)+cos(2*pi*500*n)+cos(2*pi*700*n).w] = firpmord( [300 400].Program no 17 WAP to design a LPF of same specifications being FIRPM and hanning FIR-W type and compare their outputs in time domain when a signal lying in transition band is passed through them with Ap=0. [dp ds].256)..fo. [1 0].. .mo.. y1=filter(b.X]=freqz(c.%ap=-20*log10(1-dp) as=80. figure subplot 221.. n=0:1/samp:1..%Hanning window figure subplot 131.w). 20*log10(abs(h)))..W]=freqz(b. plot(abs(fft(x))). c = fir1(L. % FIRPM [n.1.. [H. plot(W/pi.w). w=window(@hanning. subplot 222.1..1.

Figure 1 Figure 2 S BABINA DEVI DE/11/EC/17 Program no 18 .

samp=2000.4. [0 1].1. plot(W/pi. ap=0.%gaussian window figure subplot 131. figure subplot 132..%ap=-20*log10(1-dp) as=50.. I. [H.. 20*log10(abs(H))).. plot(abs(fft(y1)))...256)... 'high'..w).1.X]=freqz(c.x). [h. plot(abs(fft(y2))). % FIRPM [n.. c = fir1(L. figure subplot 221. b = firpm(n. w=window(@gausswin.5.256).fo..1. [ds dp]. y2=filter(c.x)... y1=filter(b.L+1).. subplot 133.. subplot 222.w). .. plot(abs(fft(x))).WAP to design a HPF of same specifications being FIRPM and Gaussian FIRW type and compare their outputs in time domain when a signal lying in transition band is passed through them with Ap=0.1.%as=-20*log10(ds) dp=1-10^(-ap/20). subplot 223.fo. samp ).W]=freqz(b. % guassian window.w] = firpmord( [300 400]. FIR-W L=66. plot(X/pi. plot(1:L+1.mo.. I=. Figure 1 .mo.w). 20*log10(abs(h))). x=cos(2*pi*100*n)+cos(2*pi*500*n)+cos(2*pi*700*n).. ds=10^(-as/20)..5dB and As=50dB. n=0:1/samp:1.

Figure 2 Figure 3 .

Submitted by:T.Esther Lotha DE/11/EC/018 Program no 19 .

ap=.ap.5dB and As=50dB. subplot 222. plot(n.a.WAP to design an IIRE BPF with an IIRE LPF and a HPF and compare %the result with a direct IIRE BPF with Ap=0.'high').ws.ap. x=cos(2*pi*550*n)+cos(2*pi*600*n).a1.x). as.a1.256). plot(n.wn]=ellipord(wp.ap. [b1. ws=fs2/(samp/2).y1).wn. plot(n.abs(fft(y1))) y2=filter(b1. [H. [I. samp=2000.X]=freqz(b1.W]=freqz(b. ws=fs1/(samp/2).as). %subplot 111. figure subplot 221. %plot(W/(2*pi). Close all.20*log10(abs(H))) fs2=500. fp1=500. wp=fp2/(samp/2).abs(fft(y2))) FIGURE . Clc.20*log10(abs(I))) n=0:1/samp:1. %subplot 222.abs(fft(x))) y1=filter(b. fs1=600.256).5. fp2=600. Clear.a. as=50. [N. wp=fp1/(samp/2).as. [b.wn).plot(X/(2*pi).a]=ellip(N.a1]=ellip(N.

SUBMITTED BY : Songhita misra ROLL NO.:DE/11/EC/019 .

1.%as=-20*log10(ds) dp=1-10^(-ap/20). ds=10^(-as/20). plot(1:N+1. [N. .filtype] = kaiserord( [250 300 700 750 850 900 1400 1450 ]. y=filter(b.%ap=-20*log10(1-dp) as=80.1. samp=5000. 'noscale'). b = fir1(N. kaiser(N+1.bta). subplot 122.W. w = window(@kaiser. x=cos(2*pi*100*n)+cos(2*pi*500*n)+cos(2*pi*700*n). plot(abs(fft(x))).Program no 20 WAP to design an FIR BPF with passbands 300 to 700Hz and 900 to 1400Hz with FS1 with Ap=0.256). ap=0.5.w).N+1. [h. 20*log10(abs(h))). figure subplot 121. W.bta). subplot 212. plot(abs(fft(y))).o]=freqz(b. n=0:1/samp:1. samp ).x). plot(o/pi. figure subplot 211. [ds dp ds dp ds].5dB and As=80dB. filtype.bta. [0 1 0 1 0].

Figure 1 Figure 2 Benjungkum la DE/11/EC/20 .

Program no 21
%WAP to design an FIR BSF with stopbands 100 to 400Hz, 800 to % 1000Hz and 1200 to 1400 with FS2 , Ap=0.5dB and As=50dB. Clc; Clear; Close all; samp=3000; n=0:1/samp:1; x=cos(2*pi*100*n)+cos(2*pi*500*n)+cos(2*pi*700*n); ap=0.5;%ap=-20*log10(1-dp) as=50;%as=-20*log10(ds) dp=1-10^(-ap/20); ds=10^(-as/20); [N,W,bta,filtype] = kaiserord( [50 100 400 450 750 800 1000 1050 1150 1200 1400 1450], [1 0 1 0 1 0 1], [dp ds dp ds dp ds dp], samp ); w = window(@kaiser,N+1,bta); figure subplot 121, plot(1:N+1,w); b = fir1(N, W, filtype, kaiser(N+1,bta), 'noscale'); [h,o]=freqz(b,1,256); subplot 122, plot(o/pi, 20*log10(abs(h))); y=filter(b,1,x); figure subplot 211, plot(abs(fft(x))); subplot 212, plot(abs(fft(y)));

FIGURE 1:

FIGURE 2:

SUB MITTED BY: PRERNA ROLL NO.: DE/11/EC/021

% creating filter 2 whose order is increaced by 10 k2 = window(@kaiser.bta).256). output of filter 1 and filter 2 respectively figure subplot 311. 'noscale'). % creating kaiser window k1 = window(@kaiser. % output sisnal of filter 2 whose order is increaced by 10 y2=filter(b2. 'noscale'). ds=10^(-as/20). plot(abs(fft(x))). % figure for frequense response of input. plot(abs(fft(y1))).Program no 22 To WAP to compare the variation of output for a signal in transition band of an Kaiser FIR-W as its order is increased by 10 when its input signal is lying in the transition band. [h2.bta).1. kaiser(N+11.bta). title('figure for frequense response of input'). kaiser(N+1.1. % output sisnal of filter 1 of order N y1=filter(b1. ap=0.o2]=freqz(b2.256). subplot 312.o1]=freqz(b1. b2 = fir1(N+10.filtype] = kaiserord( [300 400].1.x). % coefficient(b)calculation b1= fir1(N. % testing:% input signalx=cos(2*pi*100*n)+cos(2*pi*350*n)+cos(2*pi*700*n).bta). filtype. title('figure for frequense response of output of filter 1 '). % creating filter 1 of order N [h1. samp ). W. [dp ds].x). . n=0:1/samp:1.5. % Kaiser FIR-W design:% Order and cut off calculation for low pass filter [N. W. filtype.W.N+11.N+1. [1 0]. clc clear close all % specificationssamp=2000.%as=-20*log10(ds) dp=1-10^(-ap/20).1.bta.%ap=-20*log10(1-dp) as=50.

title('figure for kaiser window of filter 1 '). subplot 122.k2). title('figure for frequense response of output of filter 2'). . plot(abs(fft(y2))).k1). plot(1:N+11.subplot 313. % figure for kaiser window for filter 1 and 2 figure subplot 121. plot(1:N+1. title('figure for kaiser window of filter 2 ').

Submitted by :.Sandeep Banerjee (Roll No : DE/11/EC/22) .

wn).x). figure subplot 121 .a]=cheby2(N.a.20*log10(abs(H))) M=N+3.ap.as. wp=fp/(samp/2).5. %LPF of cut off 500Hz fp=500.Program no 23 . [I.plot(X/(2*pi).W]=freqz(b.plot(W/(2*pi). samp=2000. figure subplot 221. x=cos(2*pi*200*n)+cos(2*pi*700*n).a1]=cheby2(M.wn).a1.X]=freqz(b1. subplot 122 .ws. [b.abs(fft(x))) y1=filter(b.as).256). ap=. fs=600. %increase d order by 3 [b1.a. plot(n. [H.20*log10(abs(I))) n=0:1/samp:1. . ws=fs/(samp/2). [N.as.256). WAP to compare the variation of output for a signal in pass band of an IIR-CII as its order is increased by 3 when its input signal is lying in the transition band. as=40.wn]=cheb2ord(wp.

a1.y1) subplot 223. DE/11/EC/23) .subplot 222. Bijendra Singh (Roll no.abs(fft(y2))) L. plot(n. plot(n.abs(fft(y1))) y2=filter(b1.

plot(W/(2*pi). samp=2000.a1. fs2=600.x). % creating filter 2 whose order is increaced by 3 M=N+3.ap. %coefficient calculation [b. figure subplot 311.X]=freqz(b1.5. %BSF of stop band 400-600Hz %specificationsfp1=300. plot(X/(2*pi).20*log10(abs(H))) title('figure for frequense response of filter 1'). plot(abs(fft(y2))) title('figure for frequense response of output of filter 2'). y2=filter(b1.a. n=0:1/samp:1.wn]=cheb1ord(wp. [I. subplot 122. y1=filter(b.'stop').'stop').256).x). fs1=400. subplot 312. subplot 313.ap. %order and cut off calculation for band stop filter [N. [b1.Program no 24 WAP to compare the variation of output for a signal in stop band of an IIR-CI as its order is increased by 3 when its input signal is lying in the transition band. ws=[fs1 fs2]/(samp/2). fp2=700.as).ap. as=40. .ws.a1.256). %input signal x=cos(2*pi*200*n)+cos(2*pi*500*n)+cos(2*pi*800*n). %creating filter 1 of order N [H.a]=cheby1(N.wn. figure subplot 121. plot(abs(fft(x))) title('figure for frequense response of input'). plot(abs(fft(y1))) title('figure for frequense response of output of filter 1'). wp=[fp1 fp2]/(samp/2).20*log10(abs(I))) title('figure for frequense response of filter 2'). ap=.a1]=cheby1(M.a.wn.W]=freqz(b.

submitted by –Prasenjit Das .

subplot 232. figure subplot 121. %signal with frequency components 100hz.bta.w). [1 0].W. %Kaiser Frequency response y1=filter(b. % response of the kaiser window b1 = fir1(M.700hz. x=cos(2*pi*100*n)+cos(2*pi*350*n)+cos(2*pi*700*n). subplot 234.bta).M+1. plot(n. %Kaiser Frequency response [I. % fir kaiser %increasing the order by 10 M=N+10. W. [dp ds]. w = window(@kaiser. plot(o1/pi. ap=0. filtype. ds=10^(-as/20). n=0:1/samp:1. plot(1:N+1. samp=2000.bta).1.1. 'noscale').bta).bta).256). subplot 122.5.o1]=freqz(b.N+1. 'noscale'). %as=-20*log10(ds) dp=1-10^(-ap/20). subplot 233.filtype] = kaiserord( [300 400]. 20*log10(abs(H))). . samp ).(Roll no -DE/11/EC/24) Program no 25 WAP to compare the variation of output for a signal in transition % band of an Kaiser FIR-W as its order is increased by 10 when its %input signal is lying in the transition band. W. kaiser(M+1.w1).abs(fft(y1))). filtype. plot(o2/pi.1. plot(n.o2]=freqz(b1. Clear. %ap=-20*log10(1-dp) as=80.x). Clc. Close all. [H. kaiser(N+1.350hz. % KAISER FIR-W% [N. plot(1:M+1. 20*log10(abs(I))). w1 = window(@kaiser.256).abs(fft(x))). % response of the kaiser window b = fir1(N. figure subplot 231.

abs(fft(y2))). FIGURE 1: FIGURE 2: .x).y2=filter(b1.1. subplot 235. plot(n.

SU BMITTED BY:AHNA SHARAN DE/11/EC/25 .

%Program:%using Hamming window clc clear all close all samp=2000.27 %WAP to compare the variation of output for a signal in stop band of a Hamming FIR-W as its order is increased by 10 when its input signal is lying in the transition band. %number of samples .program No: . %sampling frequency n=0:1/samp:1.

N1+1). %labelling of x axis % % % % % .w2). %Hamming window figure %figure No:-1 subplot 121.4 . %title of the plot y1=filter(b1. %plot for the windows xlabel('samples') . 'stop'. %computation of frequency response subplot 122.6]. plot(1:N2+1. plot(1:N1+1.x=cos(2*pi*360*n)+cos(2*pi*620*n).grid on. %normalized cut off frequency w1=window(@Hamming. filtered output of the given signal through a filter of order N N2=N1+10.w1).4 . %labelling of x axis ylabel('Amplitude') . %filter order W1=[. plot for the window xlabel('samples') .1.x).1. plot(o/pi. %Hamming window figure %figure No:-2 subplot 121. %labelling of x axis ylabel('Amplitude') . W1. 20*log10(abs(h))). order of the filter is increased by 10 W2=[. THE DEFAULT WINDOW=Hamming [h.w1). %normalised cut off frequency w2=window(@Hamming. %labelling of y axis title 'Frequency response of order N'.6].o]=freqz(b1.N2+1). %plot of frequency response (magnitude(dB) VS Normalised frequency) xlabel(' Normalised Frequency (Hz)') . %input frequency signal in the transition band N1=66.256). %labelling of y axis title 'Hamming window plot of order N' title of the plot b1 = fir1(N1. now.

%title of the plot subplot 313. %labelling of x axis ylabel('magnitude(dB') . plot(abs(fft(x))).ylabel('Amplitude') . 'stop'. %filtered output of the given signal through a filter of order N+10 figure %figure No:-3 subplot 311. %plot of frequency response (magnitude(dB) VS Normalised frequency) xlabel('Normalised Frequency (Hz)') . %labelling of x axis ylabel('Amplitude') .256). %labelling of x axis ylabel('Amplitude') . W2. %title of the plot subplot 312.1. %labelling of x axis ylabel('Amplitude') .x). %labelling of y axis title 'Hamming window plot of order N+10' %title of the plot b2 = fir1(N2. 20*log10(abs(H))). plot(O/pi. %labelling of y axis . %plot of the output signal(amplitude VS frequency) through a filter of order N xlabel('Frequency (Hz)') .1. %plot of the output signal(amplitude VS frequency) through a filter of order N+10 xlabel('Frequency (Hz)') . %title of the plot y2=filter(b2. %labelling of y axis title 'Hamming order N output'. %labelling of y axis title 'input signal'. %plot of the input signal(amplitude VS frequency) xlabel('Frequency (Hz)') . %computation of frequency response subplot 122.w2). %THE DEFAULT WINDOW=Hamming [H. plot(abs(fft(y1))).O]=freqz(b2. plot(abs(fft(y2))). %labelling of y axis title 'Frequency response of order N+10'. grid on.

0 .8 0 .1 -0 7 0 0 -0 8 0 0 .6 Nr a e Fe un y( z omlis d r qe c H) 07 .3 0 . 3 0 . 5 -0 4 0 . 6 0 .5 0 .9 1 FIGURE2:Hmin wdw looo eN1 a mg ino p t f r r +0 d 1 1 0 F qec r s os oo eN1 r uny epne f r r +0 e d 0 . 6 Am litu e p d m g itu e B a n d (d 1 0 2 0 3 0 4 0 sm s ap le 5 0 6 0 7 0 8 0 -0 3 0 . 4 -0 5 0 .5 Nr a e F qec ( z o lis d r uny H m e ) 0 . 9 0 0 . 3 -0 6 0 .3 -0 6 0 .4 -0 5 0 .4 0 .4 0 .8 0 .9 1 FIGURE3:- .5 -0 4 0 .6 Am plitude 1 0 2 0 3 0 s mle aps 4 0 5 0 6 0 7 0 Am plitude -0 3 0 . 2 0 .9 0 0 .8 -0 1 0 .title 'Hamming order N+10 output' %title of the plot FIGURE: FIGURE 1:Hm in w d w lo o od rN a m g ino p t f r e 1 1 0 Feu nyr s os o od rN r qec e pne f r e 0 . 7 -0 2 0 . 1 -0 7 0 0 -0 8 0 0 .1 0 . 8 -0 1 0 .1 0 . 7 0 .2 0 .7 -0 2 0 .2 0 .2 0 .

4.% closes all the open figure windows% . %clears the command window% clear. 2. NIIR-CII])and compare their outputs in the pass band with FS1.e take order N= max[NIIR-CI.inp sig l ut na 10 00 Amplitude 5 00 0 0 5 00 10 0 0 F qu cy (H re en z) H m g o er Nou ut am in rd tp 15 00 2 0 00 25 0 0 10 00 Amplitude 5 00 0 0 5 00 10 0 0 F qu cy (H re en z) H m go e N 0o am in rd r +1 utpu t 15 00 2 0 00 25 0 0 10 00 Amplitude 5 00 0 0 5 00 10 0 0 F qu cy (H re en z) 15 00 2 0 00 25 0 0 Program description 1. Now. pass the given input signal into the filter and plot the output. Design another hamming window FIR filter of order N+10 and of same normalized frequency. again pass the same input signal into the second filter and plot the output. 3. Determine the sample frequency and the signal whose frequency lies in the transition band. Solution: . Submitted by : Rahul Roushan DE/11/EC/27 Program no 29 WAP to design a BPF of IIR-CI and IIR-CII of same specifications and keep their order same (i. Now. Design the hamming window FIR filter of the given order (N) and of given normalized frequency. 5.%BPF of pass band 400-600Hz clc.%Clear variables and functions from memory% close all.

wn]=cheb1ord(wp.'bandpass').'bandpass'). % {H=256 point complex frequency response vector % and W= 256 point frequency vector} % [I. wn= Chebyshev1 natural frequency}% [N2. % 0 to 1 % [N1.a]=cheby1(N. %{filter coefficients for IIR-CII %in length N+1.as).vectors b(numerator) and a(denominator)}% [c. fs2=700.a. %{N1=minimum order with the provided % specifications of IIR-CI.d.as. normalized from ws=[fs1 fs2]/(samp/2).ws.20*log10(abs(H)).wm.256).ws. %{calculates the maximum order among N1 & N2 % and returns N}% [b. the passband% as=80.d]=cheby2(N.ap.ap. stop band% wp=[fp1 fp2]/(samp/2).256).plot(W/(2*pi). %{N2=minimum order with the provided %specifications of IIR-CII.5. normalized from % % % % % 1st stopband edge frequency 1st passband edge frequency 2nd passband edge frequency 2nd stopband edge frequency sampling frequency of % 0. % 0 to 1 % % stop band edge frequencies.X]=freqz(c. fp2=600.5dB of attenuation in % 80dB of attenuation in the % pass band edge frequencies. % {I=256 point complex frequency response vector % and X= 256 point frequency vector} % figure subplot 121.'b') .N2).W]=freqz(b. %{filter coefficients for IIR-CI %in length N+1. wm= Chebyshev2 natural frequency}% N=max(N1.wn.ap. samp=2000.as).fs1=300.vectors c(numerator)and d(denominator)}% [H. 2000hz (FS1)% ap=.wm]=cheb2ord(wp. fp1=400.

plot(n.a.'r') % Frequency respnose plot of IIR-CII% xlabel('X/(2*pi)'). ylabel('y1'). title('combine plot -red=IIR-CI. blue=IIR-CII'). .'r'. %signal x passes through the IIRCI filter% subplot 222. plot(n. n=0:1/samp:1. ylabel('y2').plot(X/(2*pi). title('Frequency respnose of IIR-CII').'r') %time domain plot of IIR-CI output signal % xlabel('n'). y1=filter(b. title('output signal of IIR-CI'). %Input signal that is to be tested% figure subplot 221. subplot 224.abs(fft(y2)).% Frequency respnose plot of IIR-CI% xlabel('W/(2*pi)').x).d. title('input signal').abs(fft(y1)). plot(n. ylabel('I'). plot(n.y2').20*log10(abs(I)). ylabel('y1.abs(fft(y1)).n. %generation of points for time domain plot% x=cos(2*pi*400*n)+cos(2*pi*550*n)+cos(2*pi*630*n). %signal x passes through the IIR-CII filter% subplot 223. y2=filter(c. ylabel('x').'b') %time domain plot of IIR-CII output signal % xlabel('n'). subplot 122.x).'b') % combine plot for comparision% xlabel('n').abs(fft(x))) %time domain plot of input signal % xlabel('n'). title('output signal of IIR-CII').abs(fft(y2)). ylabel('H'). title('Frequency respnose of IIR-CI').

Figure 2.RESULT: Figure 1. Submitted by: Baddrud Zaman Laskar .

% 50dB of attenuation in the stop band% wp=fp/(samp/2). cutoff and stopband edge with FS1.% pass band edge frequencies.% stop band edge frequencies. close all. % stopband edge frequency samp=2000. normalized from % 0 to 1 % ws=fs/(samp/2). % 0. fp=500. % passband edge frequency fs=600.5dB of attenuation in the passband% as=50.DE/10/EC/101 Program no 30 WAP to design a LPF of IIR-B and IIR-E of same specifications and keep their order same (i.5. % sampling frequency of 2000hz (FS1)% ap=. normalized from % 0 to 1 % .e take order N= max[NIIR-B NIIR-E)and compare their outputs in the passband edge. Solution:%LPF of cut off 500Hz clc. clear.

a. title('Frequency respnose of IIR-B').[N1.vectors c(numerator)and d(denominator)}% [I. title('Frequency respnose of IIR-E').d]=ellip(N.wn).256). ylabel('H').ap.ws.a]=butter(N.as).ap. ylabel('I'). . subplot 122.wm).N2).wm]=ellipord(wp. %{N1=minimum order provided with the specifications of IIRB.as.plot(X/(2*pi).plot(W/(2*pi).20*log10(abs(H))) % Frequency respnose plot of IIR-B% xlabel('W/(2*pi)').ws. n=0:1/samp:1. % {H=256 point complex frequency response vector % and W= 256 point frequency vector} % [c. % wn= Butterworth natural frequency}% [N2. wm= Elliptic natural frequency}% N=max(N1. % {I=256 point complex frequency response vector % and X= 256 point frequency vector} % subplot 121. ylabel('x').%{calculates the maximum order among N1 & N2 % and returns N}% [b.d.X]=freqz(c.as). %Input signal that is to be tested% figure subplot 221. plot(n. %generation of points for time domain plot% x=cos(2*pi*480*n)+cos(2*pi*500*n)+cos(2*pi*530*n).256).W]=freqz(b. %{filter coefficients for IIR-E %in length N+1.abs(fft(x))) %time domain plot of input signal % xlabel('n'). %{N2=minimum order with the provided %specifications of IIR-E. %{filter coefficients for IIR-B %in length N+1.20*log10(abs(I))) % Frequency respnose plot of IIR-E% xlabel('X/(2*pi)').vectors b(numerator) and a(denominator)}% [H.ap.wn]=buttord(wp.

title('output signal of IIR-B').%signal x passes through the IIR-B filter% subplot 222. y2=filter(c. plot(n.x).%signal x passes through the IIR-E filter% subplot 223.abs(fft(y1))) %time domain plot of IIR-B output signal % xlabel('n'). ylabel('y1'). Result: .x). plot(n.abs(fft(y2))) %time domain plot of IIR-E output signal % xlabel('n'). y1=filter(b.d. title('output signal of IIR-E'). ylabel('y2').a.title('input signal').

.

NIIR-B])and compare their outputs in the passband edge.e take order N= max[NIIR-CII. cutoff and stopband edge with FS1.Su bmitted by Sa harul Alom Barlaskar Ro ll no: DE/10/EC/102 Program no 31 WAP to design a LPF of IIR-B and IIR-CII of same specifications and keep their order same (i. . PROGRAM: %LPF of cut off 500Hz clc.

5.d.X]=freqz(c.ws. N=max(N1.% stopband ripple wp=fp/(samp/2). fp=500.wm).wm]=cheb2ord(wp. [b.256).a]=butter(N. [I.abs(fft(y1))) y2=filter(c.20*log10(abs(H))) subplot 122. ws=fs/(samp/2).abs(fft(y2))) FIGURE1: .256).% passband ripple as=50.20*log10(abs(I))) n=0:1/samp:1. plot(n. subplot 223.% stopband frequency samp=2000.wn). close all.clear.as). x=cos(2*pi*200*n)+cos(2*pi*700*n).ap. figure subplot 221.a.as.W]=freqz(b.plot(W/(2*pi).plot(X/(2*pi).a.wn]=buttord(wp. subplot 121. [N2.d. subplot 222.x). [c.% sampling frequency (fs1) ap=.abs(fft(x))) y1=filter(b.as).d]=cheby2(N. [N1.N2). plot(n. plot(n.ws.x).% passband frequency fs=600. [H.ap.

ap. fs2=600.ws.wm]=ellipord(wp.wn]=cheb1ord(wp. as=50.as). . fp2=700. [N2. [N1. ws=[fs1 fs2]/(samp/2). fs1=400.ap.FIGURE2 SUBMITTED BY KIRAN BORAH DE/10/EC/103 Program no 32 %BSF of stop 400-600Hz fp1=300.as). ap=. wp=[fp1 fp2]/(samp/2).ws.5. samp=10000.

N=max(N1. x=cos(2*pi*200*n)+cos(2*pi*500*n)+cos(2*pi*800*n). plot(n.'stop').'stop').wn. subplot 222.abs(fft(y2))) submitted by.a.plot(X/(2*pi).N2). close all.20*log10(abs(I))) n=0:1/samp:1.a. y2=filter(c. plot(n.20*log10(abs(H))) subplot 122.X]=freqz(c.d.ap.256).abs(fft(x))) y1=filter(b.d]=ellip(N.d. [H. cutoff and stopband edge with FS2 clc. plot(n.a]=cheby1(N. figure subplot 221.ap.plot(W/(2*pi). [c.x). clear. S AURAV KUMAR DE/10/EC/104 Program no 33 WAP to design a BSF of FIR-PM and Kaiser FIR-W of same specifications and keep their order same (i.e take order N= max[NFIR-W. NFIR-PM])and compare their outputs in the passband edge.as. [I.abs(fft(y1))) subplot 223. [b.x).256). figure subplot 121. .W]=freqz(b.wm.

% fir kaiser subplot 313.fo.w). filtype.1.%ap=-20*log10(1-dp) as=40.Y. 'noscale'). kaiser(N+1.w] = firpmord( [300 400 550 650]. plot(1:N+1. N=max(N1.mo.%as=-20*log10(ds) dp=1-10^(-ap/20).bta).x).samp=5000.filtype] = kaiserord( [300 400 550 650 ]. Y.N+1. 20*log10(abs(I))).X]=freqz(c. plot(abs(fft(y1))).bta). plot(abs (fft(x))).bta.x). figure subplot 211.N2). n=0:1/samp:1. % response of the kaiser window c = fir1(N.mo.fo. plot(abs(fft(y2))). ds=10^(-as/20).w). [1 0 1]. x=cos(2*pi*100*n)+cos(2*pi*500*n)+cos(2*pi*700*n). y2=filter(c. %Kaiser Frequency response figure subplot 311. subplot 111.256). [H. ap=0. y1=filter(b. samp ). %PM Frequency response subplot 212.6. [I.1. . [N2. 20*log10(abs(H))).1. [N1. samp ). plot(X/pi.256). % firpm subplot 312. plot(W/pi.W]=freqz(b. w = window(@kaiser. b = firpm(N. [1 0 1].1. [dp ds dp]. [dp ds dp].

Fig: Frequency response of Kaiser window .

Fig: Filter output of FIRPM and Kaiser .

FIRPM filter output and kaiser Sa muel MS Dawngliana DE/10/EC/105 .output of filter Fig: Input signal.

%FIRPM Frequency response subplot 212.N+1.fo.%passband edge frequency 1000 Hz dp=1-10^(-ap/20).1.1.plot(abs(fft(y1))). figure w2=window(@kaiser.%Kaiser Frequency response figure subplot 311. y1=filter(b1.%input signal ap=.samp).20*log10(abs(h1))).filtype]=kaiserord([300 400]. y2=filter(b2.%FIR Kaiser .bta).w1]=firpmord([300 400].%ap=-20*log10(1-dp) ds=10^(-as/20).plot(o2/pi.20*log10(abs(h2))).N2).and weights in %FIRPM [N2.%stopband edge frequency 900 Hz fp=1000. cutoff and stopband edge with FS2.plot(abs(fft(x))).1.kaiser(N+1.w1).[0 1].plot(o1/pi.filtype. figure subplot 211.bta).W. close all.256).%passband attenuation 0.[ds dp].samp). subplot 111.'noscale').Program no 34 WAP to design a HPF of FIR-PM and Kaiser FIR-W of same specifications and keep their order same (i.o2]=freqz(b2. samp=5000.[ds dp].%as=-20*log10(ds) [N1.mo.o1]=freqz(b1.1. x=cos(2*pi*200*n)+cos(2*pi*500*n)+cos(2*pi*1100*n) +cos(2*pi*1500*n). % normalized frequency band edges. normalized frequency band edges Wn.plot(1:N+1.x).%sampling frequency FS2=5KHz n=0:1/samp:1. frequency band amplitudes.e take order N= max[NFIR-W.%stopband attenuation 80 dB fs=900.bta.fo.%FIRPM subplot 312. [h2. clc.x). NFIR-PM])and compare their outputs in the passband edge. %approximate order.and weights in kaiser FIR window N=max(N1. clear. [h1.[0 1].mo.5.W.%select same order b1=firpm(N.%response of kaiser window b2=fir1(N.5 dB as=80. %approximate %order N2.256).w2).

Fig: Frequency response of Kaiser window .plot(abs(fft(y2))).subplot 313.

Fig: Filter output of FIRPM and Kaiser .

Fig: Frequency domain output of the filter Submitted by: Bikash Roy .

subplot 211.W.20*log10(abs(h2))).cutoff and stopband edge with FS3.bta.[0 1]. . y2=filter(b2.4.plot(o1/pi. subplot 312.filtype. dp=1-10^(-ap/20).1. b1=fir1(N.kaiser(N+1.filtype]=kaiserord([300 400].%ap=-20*log10(1-dp) ds=10^(-as/20). figure [h2.5. n=0:1/samp:1.plot(n.256).20*log10(abs(h1))).[ds dp].bta). x=cos(2*pi*200*n)+cos(2*pi*450*n)+cos(2*pi*900*n). N=max(N1.abs(fft(x))). w1=window(@kaiser. figure subplot 111. close all.N+1).plot(o2/pi.256).bta). [h1.N2). as=80.x).w). b2=fir1(N.plot(n.W1. samp=10000.'noscale').W.1. clc. w=window(@hamming. figure subplot 311. y1=filter(b1.plot(1:N+1.N+1. W1=.o2]=freqz(b2. clear. % response of the kaiser window subplot 111.o1]=freqz(b1.samp). fp=800.1. fs=700. ap=.x).%as=-20*log10(ds) N1=66.DE/10/EC/106 Program no 35 WAP to design a HPF of Hamming FIR-W and Kaiser FIR-W of same specifications and keep their order same and compare their outputs in the passband edge.w1). subplot 212.w).'high'.1. [N2.plot(1:N+1.abs(fft(y1))).

plot(n.subplot 313.abs(fft(y2))). Fig:Frequency response of the hamming window Fig:Frequency response of the kaiser window .

Fig: Filter output of hamming and Kaiser Fig: Frequency domain output of the filter Submitted by:Abhinoy Ray .

1. figure [h2.1.w1). N1=66.plot(1:N+1.%sampling frequency FS3=10KHz n=0:1/samp:1. cutoff and stopband edge with FS3.plot(abs(fft(y2))).[dp ds].256).W2. subplot 313.bta).1. subplot 312.4.1.%passband edge frequency 800 Hz fs=900.plot(o2/pi. fp=800.5.20*log10(abs(h2))). w=window(@gausswin. W1=.o2]=freqz(b2.%response of gausswin window b1=fir1(N. y1=filter(b1.'low'. clear.DE/10/EC/108 Program no 36 WAP to design a LPF of Gaussian FIR-W and Kaiser FIR-W of same specifications and keep their order same and compare their outputs in the passband edge.x). b2=fir1(N.samp). . y2=filter(b2.plot(abs(fft(x))). dp=1-10^(-ap/20).w). as=80.N+1.W1.'noscale').w).256).N2).plot(abs(fft(y1))).o1]=freqz(b1.%stopband edge frequency 900 Hz ap=.x).filtype]=kaiserord([300 400]. [N2. subplot 111. N=max(N1. samp=10000.[1 0].%response of kaiser window figure subplot 111. ds=10^(-as/20).plot(1:N+1.filtype.N+1). x=cos(2*pi*300*n)+cos(2*pi*400*n)+cos(2*pi*600*n).W2.kaiser(N+1.plot(o1/pi.20*log10(abs(h1))). close all. [h1. figure subplot 311. subplot 212. clc.bta.bta). w1=window(@kaiser. subplot 211.

Fig: Frequency response of gausswin window Fig: Frequency response of kaiser window .

Fig: Filter output of gausswin and Kaiser Fig: Frequency domain output of the filter Bikash Khandal DE/10/EC/109 .

1. samp ). cutoff and stopband edge with FS2. . b1=fir1(N1. 20*log10(abs(h))). subplot 122.N1+1). W1=[. plot(abs(fft(y1))).32 .256). N1=N2. subplot 313. plot(o/pi.x).1.w1). %sampling frequency n=0:1/samp:1. samp=5000.1.w1). filtype.%passband attenuation as=80. plot(abs(fft(y2))).%normalised frequency w1=window(@blackmanharris. plot(abs(fft(x))). figure subplot 311.%stopband deviaion [N2.w2).4]. [ds dp ds].W1. plot(1:N2+1.bta).%kaiser window figure subplot 121. [h.filtype] = kaiserord( [ 700 800 1000 1100 ]. %passband frequency fs2=1000.Program no 37 WAP to design a BPF of Blackman Harries FIR-W and Kaiser FIR-W ofsamespecifications and keep& %their order same and compare their outputs in the passband edge. %input signal% fs1=700.bta.5. %stopband attenuation dp=1-10^(-ap/20).%Blackman Harris Window figure subplot 121.N2+1. b2 = fir1(N2. plot(O/pi.plot(1:N1+1. subplot 122. y1=filter(b1.%kaiserord passband filter w2 = window(@kaiser.256). kaiser(N2+1. % samples x=cos(2*pi*750*n)+cos(2*pi*800*n)+cos(2*pi*1050*n) +cos(2*pi*1070*n). 20*log10(abs(H))).% passband deviation ds=10^(-as/20). subplot 312.1.W2. [H. %passband frequency ap=.%stop ferquency fp2=1100. %stop frequency fp1=800.x).O]=freqz(b2. 'noscale'). W2.o]=freqz(b1. [0 1 0].'bandpass'.bta). y2=filter(b2.

3 -100 0.5 0.5 1 FIGURE:2 .4 0.9 0.7 0.6 0.8 -20 0.FIGURE:1 1 0.1 0 -120 -140 -40 -60 -80 20 0 0 100 200 300 0 0.2 0.

3 0.5 0.1 0.9 0.7 0.5 1 FIGURE:3 3000 2000 1000 0 1500 1000 500 0 3000 2000 1000 0 0 1000 2000 3000 4000 5000 6000 0 1000 2000 3000 4000 5000 6000 0 1000 2000 3000 4000 5000 6000 .4 0.6 0.8 0.1 0 0 -20 -40 -60 -80 -100 -120 -140 -160 -180 -200 0 100 200 300 0 0.2 0.

.-Submitted by. Manish Singh DE/10/EC/110.

x). [H1. .1. y2=filter(b1.w). figure subplot 121.256). figure subplot 121.plot(abs(fft(x)))%time domain plot of input signal y1=filter(b.w).W.4. % 80dB of attenuation in the stopband% fs1=300.1.plot(O/pi. %BPF forIIR-CII type.%passband edge1 frequency fp2=500. clear.plot(1:N+1. b=fir1(N.'bandpass'.N+1). [H. normalized from 0 to 1 ws=[fs1 fs2]/(samp/2).O1]=freqz(b.O]=freqz(b.as).%cutt off frequency w=window(@chebwin. %passband edge2 frequency fs2=600. %stop band edge1 frequency fp1=400. %stop band edge2 frequency wp=[fp1 fp2]/(samp/2). N=66.a.wn]=cheb2ord(wp.a]=cheby2(h1.20*log10(abs(H1)))%Frequency respnose plot of IIR -chebyshev2 figure subplot 231. clc.ap. close all.5 and as=80dB with FS2. %bpf for chebwin.x).256).as.wn. %bandpass filter of band 400-500.plot(O1/2*pi.%calling chebwin window.5 .% band stop edge frequencies.ws.% pass band edge frequencies.5dB of attenuation in the passband% as=80.. x=cos(2*pi*200*n)+cos(2*pi*500*n)+cos(2*pi*700*n).'bandpass'). ap=.Program no: 38 WAP to design a BPF of same specification being chebyshaw FIR-W and compare their outputs in time domain when a signal lying in transition band is passed through them with ap=.%{N=minimum order provided with the specifications of chebwin W=[.6].20*log10(abs(H)))%Frequency respnose plot of chewinFIR-w window subplot 122. normalized from 0 to 1 [h1. n=0:1/samp:1. samp=2000.a.% 0. [b1.

plot(abs(fft(y1)))%time domain plot of output signal of chebwin FIR-w subplot 233.abs(fft(y2)))%time domain plot of output signal of IIR-CII .plot(n.subplot 232.

RESULT: Fig: 1 chebwin window figure Fig:2 response of the chebwin FIR-W and IIR-CII filter type respectively .

Fig3: Input and output of chebwin FIR-W and IIR-CII type window RANDHEER KUMAR RAVI DE/11/EC/06 .

plot(X/(2*pi).wn]=cheb1ord(wp.% 0.ap.% {H=256 point complex frequency response vector % and O= 256 point frequency vector} % subplot 122. fp=600.%stopband edge frequency wp=fp/(samp/2). % coefficient for Chebywin% [H.N+1).'high'). %filtered output% figure subplot 221.%passband edge frequency fs=500.256).vectors b1(numerator) and a1(denominator)}% [I.w). %in length N+1.'high'.1.ws.%{N=minimum order provided with the specifications of chebyshev FIRW.x). Solution: %HPF of cut off 600hz samp=5000.wn.X]=freqz(b1.w). plot(abs(fft(x)))%time domain plot of input signal % subplot 222.5dB and As=80dB with FS2.as). %cutt off frequency% w=window(@chebwin.5dB of attenuation in the passband% as=80. n=0:1/samp:1.W. b=fir1(N.20*log10(abs(I))) % frequency response plot% .% stop band edge frequencies.20*log10(abs(H)))% Frequency respnose plot of chebyshev FIRW% y=filter(b. x=cos(2*pi*700*n)+cos(2*pi*550*n).% pass band edge frequencies. plot(O/pi.24.O]=freqz(b.%{N1=minimum order provided with the specifications of IIR-CI. % frequency respnose Vector% figure subplot 111. % wn= natural frequency}% [b1.a1]=cheby1(N1.plot(abs(fft(y)))%time domain plot of output signal % [N1.a1. WAP to design a HPF of same specifications being Cebyshev FIR-W and IIR-CI type and compare their outputs in time domain when a signal lying in transition band is passed through them with Ap=0. normalized from 0 to 1 % ws=fs/(samp/2). W=.ap.5.% 80dB of attenuation in the stopband% N=66. plot(1:N+1.Prg 39.1.256). normalized from 0 to 1 % ap=0. % calling chebyshev window% subplot 121.

6 -60 0. Window response.1 0 -100 -120 -140 -160 20 0 -20 0 20 40 60 80 0 0.n=0:1/samp:1.x).3 0. frequency response of Chebyshev FIR-W .7 -40 0.2 0.5 1 Figure(1). figure subplot 211. plot(n. plot(n. subplot 212.abs(fft(x))) y2=filter(b1.5 -80 0.9 0.4 0.8 0.abs(fft(y2))) RESULT: 1 0.a1.

15 0.1 0.25 0. input signal.2 0. output signal 0 -50 -100 -150 -200 -250 -300 0 0.05 0.5 Fig(3): frequency response of IIR-CI .45 0.3 0.35 0.2500 2000 1500 1000 500 0 0 2000 4000 6000 2500 2000 1500 1000 500 0 0 2000 4000 6000 Fig(2).4 0.

9 1 Submitted by Baddrud Zaman laskar(DE/10/EC/101) 0 0 Fig(4): input signal. 80 . 10 . 20 . 80 . 40 . 20 . 10 . 30 . 60 . 7 0 . 40 . output signal . 50 . 50 . 9 1 4 0 0 0 2 0 0 0 0 0 0 . 7 0 .4 0 0 0 2 0 0 0 0 . 30 . 60 .

title('time domain plot for output of y'). plot(abs(fft(x2))). subplot 222. subplot 224.1. %coefficients for linearity check %input signals x1=cos(2*pi*500*n).xlabel('discrete time(n)').title('frequency domain plot of output of x1(y1)').ap. d=-1.%stopband attenuation %edge frequency bands wp=fp/(samp/2).title('frequency domain plot of output of x1(y2)').%passband attenuation as=40. x2=cos(2*pi*700*n).20*log10(abs(H))).%initially relaxed ap=.yt(1:100)). plot(abs(fft(y2))). grid.title('time domain plot for output of yt').xlabel('discrete time(n)').a]=butter(M. fp=500. ws=fs/(samp/2).ylabel('magnitude of yt').plot(abs(fft(x1))). c=2.%output of x2 figure subplot 111.xlabel('discrete time(n)'). M=N-2.dif(1:100)).title('time domain plot for output of dif').%Question 40.256).as).x1). %stop band frequency samp=2000.y(1:100)).%output of x1 y2=filter(b.1). if abs(sum(sum(dif)))<10^(-3) disp('FILTER IS LINEAR') else disp('FILTER IS NON-LINEAR') end figure subplot(3. %pass band frequency fs=600.%decresing the order [b. y=filter(b.a.a. [H.plot(W/(2*pi). subplot(3.ylabel('magnitude of dif').title('frequency domain plot of input signal x2'). y1=filter(b. grid. subplot 223. Output: FILTER IS LINEAR . dif=y-yt.1. stem(n(1:100). %sampling frequency n=0:1/samp:1. subplot(3.ylabel('magnitude of y'). stem(n(1:100).plot(abs(fft(y1))).a.title('frequency domain plot of input signal x1').x).wn]=buttord(wp.W]=freqz(b. ic=[0.0]. stem(n(1:100).3).WAP to design a IIR-B LPF reduce the minimum order by 2 and check its linearity property. x=c*x1+d*x2.2). %Design of filter [N. grid.ws.%output of x %linearity checking yt=c*y1+d*y2.5.wn).a. figure subplot 221.x2).1.

f e u n yd minp t o in u s n l x r q e c o a lo f p t ig a 1 10 00 fr q e c d minp t o in u s n l x e u n y o a lo f p t ig a 2 10 00 50 0 50 0 0 0 10 00 20 00 30 00 0 0 10 00 20 00 30 00 f e u n yd minp t o o tp t o x ( 1 r q e c o a lo f u u f 1y ) 10 00 fr q e c d minp t o o tp t o x ( 2 e u n y o a lo f u u f 1y ) 1 50 0 0 .3 0 .4 0 .2 0 .1 05 .3 05 .5 .4 05 .5 0 0 10 00 20 00 30 00 0 0 10 00 20 00 30 00 5 0 0 -0 5 -0 10 -5 10 -0 20 -5 20 -0 30 -5 30 0 05 .0 0 .1 0 .2 05 .

02 0.015 magnitude of dif 0.03 0.01 0.005 0.025 0.04 0.035 0.015 0.045 0.025 0.03 0.04 0.time domain plot for output of y magnitude of y 2 0 -2 0 0.05 2 0 -2 0 0.035 discrete time(n) time domain plot for output of dif 0.01 0.03 discrete time(n) 0.045 0.01 0.02 0.05 Submitted by: Manish Sharma(DE/11/EC/13) .005 0.04 0.025 0.02 0.035 discrete time(n) time domain plot for output of yt 0.005 -14 0.045 0.015 0.05 magnitude of yt 2 0 -2 0 x 10 0.

ap.a2. break end if abs(h(k))<10^(-6).5. ne=0:Np.ws. ws=fs/(samp/2). disp('UNSTABLE LTI SYSTEM'). end end figure stem(ne.20*log10(abs(X))).ap).wn. for k=1:Np+1 sum=sum+h(k). [b2. figure subplot 111. %sampling frequency ic=[0.plot(I/(2*pi). grid. disp('STABLE LTI SYSTEM').9441 . [I.%stopband attenuation wp=fp/(samp/2).as). disp('Total Sum of impulses =').h). disp('STABLE LTI SYSTEM').%number of samples h=impz(b2.256).a2]=cheby1(M.X]=freqz(b2. %Design of filter [N.a2.0].%passband attenuation as=40. %check for the stability Np=200. fp=500.WAP to design a IIR-CI LPF reduce the minimum order by 2 and check its stability property.title('time domain plot of immpulse responses').%Q41.wn]=cheb1ord(wp. %pass band frequency fs=600. disp(sum) Output: STABLE LTI SYSTEM Total Sum of impulses = 0. if abs(sum)>10^6. %stop band frequency samp=2000.%impulse response sum=0. % decresing the order by 2 M=N-2. break end if k==N+1.Np+1).%initially relaxed ap=.

2 tim d m inp t o im p ls re p n e e o a lo f m u e s o s s 0 .0 0 .2 -0 5 .1 -0 .1 0 5 0 -5 -1 0 -1 5 -2 0 -2 5 -3 0 -3 5 -4 0 -0 .1 0 .1 0 5 .5 0 .3 0 .1 -0 .0 0 0 5 .2 0 .2 -0 .3 0 2 0 4 0 6 0 8 0 10 0 10 2 10 4 10 6 10 8 20 0 Submitted by: Danish Khan (DE/11/EC/07) .1 0 -0 .1 -0 5 .4 0 .

1).a. %Testing x=3*cos(2*pi*0.2). subplot(3.D=10.3).ap.20*log10(abs(H))) title('frequency response'). ap=.1. samp=2000.as. [b. %Co-efficient calc. subplot(3. [N.x).a1. %LPF of cut off 500Hz clc clear clear all %Specification fp=500. wp=fp/(samp/2). n=0:1/samp:1. title('Output of Input Without Delay'). as=40.as).wn).W]=freqz(b.1.stem(yd).(initial condition is zero) y=filter(b1.5. M=N-2.grid. ws=fs/(samp/2).a1]=ellip(M.256).ap.1.grid. subplot 111.%delayed output of y d=y-yd(1+D:41+D).D) x].4*ne).a1.X]=freqz(b1.wn).256).%difference of the outputs subplot(3. figure %delay=d=10 ne=0:40.%delayed input of x %ic=[0 0].as.Program no 42 WAP to design a IIR-E LPF reduce the minimum order by 2 and check its time %invariance property.ws.xd).stem(y). .%reducing order by 2 %Co-efficient of New designed Filter [b1.grid. %Frequency Response of New designed Filter [I. title('output with delay').a]=ellip(N.ap. xd=[zeros(1.1*ne)-2*cos(2*pi*0. %Frequency Response [H. fs=600. plot(W/(2*pi).stem(d). yd=filter(b1.a1. %Order &natural freq.wn]=ellipord(wp.

Submitted by:Debajyoti Deb (DE/11/EC/002) .title('output of the difference between both outputs').

. x1=cos(2*pi*400*n). ic=[0. [1 0]. n=0:1/samp:1. %specification ap=0.0].2). subplot(3.mo. ds=10^(-as/20). y5=filter(b. c=2.1. %plot the o/ps subplot(3..1. if abs(sum(sum(d)))<10^(-3) disp('LTI SYSTEM IS LINEAR') else disp('LTI SYSTEM IS NON-LINEAR') end Result LTI system is non-linear .3)..%coefficient calculation [h. x2=cos(2*pi*600*n).%freq response y3=filter(b. d=-3.. [dp ds]..1.1. [N..Program no 43 WAP to design a FIR-PM LPF reduce the minimum order by 5 & check linearity..%relaxed initial condition %..x2).o]=freqz(b.mo.%ap=-20*log10(1-dp) as=80.dif). yt=c*y3+d*y4..5.1.1. samp=2000.. close all..fo..w).256). samp ).y5)..plot(n.. M=N-5. dif=y5-yt.x1).x).. plot(n. y4=filter(b.%order reduced by 5 b=firpm(M.. clc...1)..1.yt). plot(n..%as=-20*log10(ds) dp=1-10^(-ap/20). subplot(3.fo.design FIR-PM LPF.w] = firpmord( [500 600]... clear. x=c*x1+d*x2.

Fig: linearity check.Ansh (DE/11/EC/10) . Done by :.

..1. plot(o/pi...plot the o/ps.%plot the window b = fir1(M.....%as=-20*log10(ds) dp=1-10^(-ap/20).x). y1=filter(b.1.0].x2). M=N-5. %decreasing d order by 5 w = window(@kaiser. 'noscale').. figure subplot 221. 20*log10(abs(h)))...plot the o/ps.% generation of the window figure subplot 211.256).%plot the impulse response y=filter(b.1. samp=2000.%. [dp ds]..% second i/p x=c*x1+d*x2.kaiser LPF-W designing.. [1 0]..% first i/p x2=cos(2*pi*350*n).. dif=y3-yt.%. filtype. samp ). %display whether the system is linear or non-linear if abs(sum(sum(dif)))<10^(-3) disp('LTI SYSTEM IS LINEAR') else .. plot(1:M+1.. c=2..%freq response calculation subplot 212.....bta).x1)... [N. yt=c*y+d*y1.plot(n. %specification ap=0.o]=freqz(b.y)... close all.% relaxed initial condition %. ..y1). plot(n.bta).%ap=-20*log10(1-dp) as=80. clc... kaiser(M+1.. subplot 222.filtype] = kaiserord( [300 400]... W..bta.1.Program no 44 WAP to design a Kaiser FIR-W LPF reduce the minimum order by 5 & check linearity.5. ic=[0. d=-3... y3=filter(b.. x1=cos(2*pi*200*n).M+1.... n=0:1/samp:1. clear.w). .W... ds=10^(-as/20). %coefficient calculation [h.....

...%.yt).dif).plot the o/ps....%.disp('LTI SYSTEM IS NON-LINEAR') end subplot 223.y3).plot the o/ps.. subplot 224.. plot(n. plot(n. Result LTI SYSTEM IS LINEAR . figure plot(n.

Done by :.Ansh (DE/11/EC/10) .

Sign up to vote on this title
UsefulNot useful