Professional Documents
Culture Documents
com
PA R I VA K K A M , P O O N A M A L L E E , C H E N N A I - 5 6
CHENNAI 600 056
NAME
REG NO
YEAR /SEM :
www.Vidyarthiplus.com
www.Vidyarthiplus.com
REGISTER NUMBER:
BONAFIDE CERTIFICATE
Signature of HOD
Internal Examiner
External Examiner
www.Vidyarthiplus.com
www.Vidyarthiplus.com
INDEX
S.No
Date
1.
2.
Generation of signals
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
USING TMS320C5X
www.Vidyarthiplus.com
Page
No
Staff
Sign
www.Vidyarthiplus.com
www.Vidyarthiplus.com
www.Vidyarthiplus.com
AIM:
To study various MATLAB function.
FUNCTIONS:
clc: Clear the command window.
xlabel: Label for X-axis.
ylabel: Label for Y-axis.
title: Title to the graph.
gird: To display grid lines in graph.
abs (x): This command computes the absolute value of the element of
x,when x is complex abs(x) is the magnitude of the element of x
angle (x): This command computer the phase angle in radians of
vector x.
log10(x): This command computes the logarithm to the base 10 if the
element x.
rem(n,m): This command determines the remainder after dividing n
by N.
log (x): This command determines the remainder natural logarithm of
each element in x.
mod (m,N): This command computes m mod N.
ones (N): Its an N-by-N matrix of ones.
ones (m,n): Its an m-by-n matrix of ones.
zeros (n): Its an n-by-n matrix of zeros .
plot (x,y): Plot vector y versus vector x.
subplot (a,b,c): It breaks the figure window in a-by-b matrix if small
axis selects the Cth axis for the current point.
[b,w] freq z (b,a,N): It returns the N-point freq response vector h and
n-point freq vector w in redians/sample of fig filter described by (b,a)
where a and b are numerator and denominator co-efficient vector.
h = freqz (b,a,w): It returns the freq response at frequencies
designated in vector w in radians/samples.
h = filter (b,a,x): It filters the data in vector x with the filter data y by
the vector a and b to create the filtered data y.
y = conv (x,h): It computes the convolution of two sequence x and h.
www.Vidyarthiplus.com
www.Vidyarthiplus.com
www.Vidyarthiplus.com
www.Vidyarthiplus.com
RESULT:
Thus, the MATLAB function used in the program are studied.
www.Vidyarthiplus.com
www.Vidyarthiplus.com
www.Vidyarthiplus.com
www.Vidyarthiplus.com
PROGRAM:
% program for Unit Step Signal
clc;
t=0:1:10;
y=ones(1,11);
subplot(3,2,1);
plot(t,y,'k');
xlabel('Time');
ylabel('Amplitude');
title('Unit step Signal');
% program for Unit ramp Signal
clc;
t1=0:1:10;
y1=t1;
subplot(3,2,2);
plot(t1,y1,'k');
xlabel('Time');
ylabel('Amplitude');
title('Unit Ramp Signal');
% program for Sine wave
clc;
t2=0:0.1:10;
y2=sin(t2);
subplot(3,2,3);
plot(t2,y2,'k');
xlabel('Time');
ylabel('Amplitude');
title('Sine Wave');
% program for Cosine Wave
clc;
t3=0:0.1:10;
y3=cos(t3);
subplot(3,2,4);
www.Vidyarthiplus.com
www.Vidyarthiplus.com
plot(t3,y3,'k');
xlabel('Time');
ylabel('Amplitude');
title('Cosine Wave');
% program for Square wave
clc;
t4=0:0.001:10;
y4=square(t4);
subplot(3,2,5);
plot(t4,y4,'k');
xlabel('Time');
ylabel('Amplitude');
title('Square Wave');
% program for Sawtooth Wave
clc;
t5=0:0.1:10;
y5=sawtooth(t5);
subplot(3,2,6);
plot(t5,y5,'k');
xlabel('Time');
ylabel('Amplitude');
title('Sawtoth Wave');
www.Vidyarthiplus.com
www.Vidyarthiplus.com
www.Vidyarthiplus.com
www.Vidyarthiplus.com
stem(n4,y4,'k');
xlabel('Time');
ylabel('Amplitude');
title('Exponential Sequence');
% program for Unit Impulse
n5=-3:1:3;
y5=[zeros(1,3),ones(1,1),zeros(1,3)];
subplot(3,2,6);
stem(n5,y5,'k');
xlabel('Time');
ylabel('Amplitude');
title('Unit Impulse');
www.Vidyarthiplus.com
www.Vidyarthiplus.com
www.Vidyarthiplus.com
www.Vidyarthiplus.com
www.Vidyarthiplus.com
www.Vidyarthiplus.com
RESULT:
www.Vidyarthiplus.com
www.Vidyarthiplus.com
www.Vidyarthiplus.com
www.Vidyarthiplus.com
PROGRAM:
% PROGRAM FOR LINEAR CONVOLUTION
%input seq
clc;clear all;close all;
x=input('Enter the input sequence(n)= ');
N1=length(x);
n=0:1:(N1-1);
subplot(3,1,1);
stem(n,x,'k');
xlabel('n----->');
ylabel('Amplitude');
title('input sequence X(n)');
%impulse seq.
h=input('Enter the impulse sequence h(n)= ');
N2=length(h);
n1=0:1:N2-1;
subplot(3,1,2);
stem(n1,h,'k');
xlabel('n--->');
ylabel('Amplitude');
title('impulse sequence h(n)');
%Output conv.
y=conv(x,h);
N=N1+N2-1;
n2=0:1:N-1;
subplot(3,1,3);
stem(n2,y,'k');
xlabel('Time');
ylabel('Amplitude');
title('Linear Convolution of two sequence');
www.Vidyarthiplus.com
www.Vidyarthiplus.com
www.Vidyarthiplus.com
www.Vidyarthiplus.com
end
disp('Convolution of x1(n) & x2(n) is');
disp(y);
subplot(3,1,3);
stem(y);
xlabel('n--->');
ylabel('Amplitude');
title('Convolution of x1(n)&x2(n) Response');
www.Vidyarthiplus.com
www.Vidyarthiplus.com
www.Vidyarthiplus.com
www.Vidyarthiplus.com
RESULT:
www.Vidyarthiplus.com
www.Vidyarthiplus.com
www.Vidyarthiplus.com
www.Vidyarthiplus.com
PROGRAM:
%prog for sampling and effect of alliasing
clc;close all; clear all;
% Time period of 50 Hz signal with 0.1s duration at 1000Hz
t=0:0.001:0.1;
fm = 15;
x=sin(2*pi*fm*t);
figure(1)
plot(t,x);
xlabel('Time');
ylabel('Amplitude');
title('Original Analog signal');
%Analog sig sampled at fs<<2fm
fs=10;
n=0:1/fs:0.1;
xn=sin(2*pi*fm*n);
figure(2)
subplot(2,1,1);
stem(n,xn);
xlabel('Time');
ylabel('Amplitude');
title('Undersampled fs<<2fm signal');
subplot(2,1,2);
plot(n,xn);
xlabel('Time');
ylabel('Amplitude');
title('Reconstructed undersampled fs<<2fm signal');
www.Vidyarthiplus.com
www.Vidyarthiplus.com
subplot(2,1,2);
plot(n,xn);
xlabel('Time');
ylabel('Amplitude');
title('Reconstructed Nyquist rate fs=2fm signal');
www.Vidyarthiplus.com
www.Vidyarthiplus.com
subplot(2,1,2);
plot(n,xn);
xlabel('Time');
ylabel('Amplitude');
title('Reconstructed oversampled fs>>2fm signal');
www.Vidyarthiplus.com
www.Vidyarthiplus.com
www.Vidyarthiplus.com
www.Vidyarthiplus.com
RESULT:
www.Vidyarthiplus.com
www.Vidyarthiplus.com
www.Vidyarthiplus.com
www.Vidyarthiplus.com
PROGRAM:
%FIR filter using HAMMING window
clc;
clear all;
close all;
wc=.5*pi;
N=input('Enter the length of sequence = ');
alpha=(N-1)/2;
eps=.001;
n=0:1:N-1;
%low pass filter
hd=sin(wc*(n-alpha+eps))./(pi*(n-alpha+eps));
wh=hamming(N);
hn=hd.*wh';
w=0:.01:pi;
h=freqz(hn,1,w);
figure(1);
plot(w/pi,abs(h),'-');
title('low pass filter');
xlabel('Normalised frequency \omega/\pi');
ylabel('Magnitude');
disp('Low pass filter co-efficient');
disp(hn);
%high pass filter
hd=(sin(pi*(n-alpha+eps))-sin(wc*(n-alpha+eps)))./(pi*(nalpha+eps));
wh=hamming(N);
hn=hd.*wh';
w=0:.01:pi;
www.Vidyarthiplus.com
www.Vidyarthiplus.com
h=freqz(hn,1,w);
figure(2);
plot(w/pi,abs(h),'-');
title('high pass filter');
xlabel('Normalised frequency \omega/\pi');
ylabel('Magnitude');
disp('high pass filter co-efficient');
disp(hn);
%band pass filter
wc1=.25*pi;wc2=.75*pi;
hd=(sin(wc2*(n-alpha+eps))-sin(wc1*(n-alpha+eps)))./(pi*(nalpha+eps));
wh=hamming(N);
hn=hd.*wh';
w=0:.01:pi;
h=freqz(hn,1,w);
figure(3);
plot(w/pi,abs(h),'-');
title('Band pass filter');
xlabel('Normalised frequency \omega/\pi');
ylabel('Magnitude');
disp('band pass filter co-efficient');
disp(hn);
%band stop filter
hd=(sin(wc1*(n-alpha+eps))-sin(wc2*(n-alpha+eps))+sin(pi*(nalpha+eps)))./(pi*(n-alpha+eps));
wh=hamming(N);
hn=hd.*wh';
w=0:.01:pi;
h=freqz(hn,1,w);
www.Vidyarthiplus.com
www.Vidyarthiplus.com
figure(4);
plot(w/pi,abs(h),'-');
title('Band reject filter');
xlabel('Normalised frequency \omega/\pi');
ylabel('Magnitude');
disp('band reject filter co-efficient');
disp(hn);
www.Vidyarthiplus.com
www.Vidyarthiplus.com
0.5000 -0.2723
0.0004
0.0155
0.0000
0.1593 -0.0001
www.Vidyarthiplus.com
www.Vidyarthiplus.com
RESULT:
www.Vidyarthiplus.com
www.Vidyarthiplus.com
www.Vidyarthiplus.com
www.Vidyarthiplus.com
PROGRAM:
%FIR filter using HANNING window
clc;
clear all;
close all;
wc=.5*pi;
N=input('Enter the length of sequence = ');
alpha=(N-1)/2;
eps=.001;
n=0:1:N-1;
%low pass filter
hd=sin(wc*(n-alpha+eps))./(pi*(n-alpha+eps));
wh=hanning(N);
hn=hd.*wh';
w=0:.01:pi;
h=freqz(hn,1,w);
figure(1);
plot(w/pi,abs(h),'-');
title('low pass filter');
xlabel('Normalised frequency \omega/\pi');
ylabel('Magnitude');
disp('Low pass filter co-efficient');
disp(hn);
%high pass filter
hd=(sin(pi*(n-alpha+eps))-sin(wc*(n-alpha+eps)))./(pi*(nalpha+eps));
wh=hanning(N);
hn=hd.*wh';
w=0:.01:pi;
h=freqz(hn,1,w);
www.Vidyarthiplus.com
www.Vidyarthiplus.com
figure(2);
plot(w/pi,abs(h),'-');
title('high pass filter');
xlabel('Normalised frequency \omega/\pi');
ylabel('Magnitude');
disp('high pass filter co-efficient');
disp(hn);
%band pass filter
wc1=.25*pi;wc2=.75*pi;
hd=(sin(wc2*(n-alpha+eps))-sin(wc1*(n-alpha+eps)))./(pi*(nalpha+eps));
wh=hanning(N);
hn=hd.*wh';
w=0:.01:pi;
h=freqz(hn,1,w);
figure(3);
plot(w/pi,abs(h),'-');
title('Band pass filter');
xlabel('Normalised frequency \omega/\pi');
ylabel('Magnitude');
disp('band pass filter co-efficient');
disp(hn);
%band stop filter
hd=(sin(wc1*(n-alpha+eps))-sin(wc2*(n-alpha+eps))+sin(pi*(nalpha+eps)))./(pi*(n-alpha+eps));
wh=hanning(N);
hn=hd.*wh';
w=0:.01:pi;
h=freqz(hn,1,w);
www.Vidyarthiplus.com
www.Vidyarthiplus.com
figure(4);
plot(w/pi,abs(h),'-');
title('Band reject filter');
xlabel('Normalised frequency \omega/\pi');
ylabel('Magnitude');
disp('band reject filter co-efficient');
disp(hn);
www.Vidyarthiplus.com
www.Vidyarthiplus.com
0.5000 -0.2456
0.0002
0.0085
0.0000
0.5000 -0.0002
0.0988 -0.0000
www.Vidyarthiplus.com
www.Vidyarthiplus.com
RESULT:
www.Vidyarthiplus.com
www.Vidyarthiplus.com
www.Vidyarthiplus.com
www.Vidyarthiplus.com
PROGRAM:
%FIR filter using BLACKMAN window
clc;
clear all;
close all;
wc=.5*pi;
N=input('Enter the length of sequence = ');
alpha=(N-1)/2;
eps=.001;
n=0:1:N-1;
%low pass filter
hd=sin(wc*(n-alpha+eps))./(pi*(n-alpha+eps));
wh=blackman(N);
hn=hd.*wh';
w=0:.01:pi;
h=freqz(hn,1,w);
figure(1);
plot(w/pi,abs(h),'-');
title('low pass filter');
xlabel('Normalised frequency \omega/\pi');
ylabel('Magnitude');
disp('Low pass filter co-efficient');
disp(hn);
%high pass filter
hd=(sin(pi*(n-alpha+eps))-sin(wc*(n-alpha+eps)))./(pi*(nalpha+eps));
wh=blackman(N);
hn=hd.*wh';
w=0:.01:pi;
www.Vidyarthiplus.com
www.Vidyarthiplus.com
h=freqz(hn,1,w);
figure(2);
plot(w/pi,abs(h),'-');
title('high pass filter');
xlabel('Normalised frequency \omega/\pi');
ylabel('Magnitude');
disp('high pass filter co-efficient');
disp(hn);
%band pass filter
wc1=.25*pi;wc2=.75*pi;
hd=(sin(wc2*(n-alpha+eps))-sin(wc1*(n-alpha+eps)))./(pi*(nalpha+eps));
wh=blackman(N);
hn=hd.*wh';
w=0:.01:pi;
h=freqz(hn,1,w);
figure(3);
plot(w/pi,abs(h),'-');
title('Band pass filter');
xlabel('Normalised frequency \omega/\pi');
ylabel('Magnitude');
disp('band pass filter co-efficient');
disp(hn);
%band stop filter
hd=(sin(wc1*(n-alpha+eps))-sin(wc2*(n-alpha+eps))+sin(pi*(nalpha+eps)))./(pi*(n-alpha+eps));
wh=blackman(N);
hn=hd.*wh';
w=0:.01:pi;
h=freqz(hn,1,w);
www.Vidyarthiplus.com
www.Vidyarthiplus.com
figure(4);
plot(w/pi,abs(h),'-');
title('Band reject filter');
xlabel('Normalised frequency \omega/\pi');
ylabel('Magnitude');
disp('band reject filter co-efficient');
disp(hn);
www.Vidyarthiplus.com
www.Vidyarthiplus.com
0.0001
0.0414
www.Vidyarthiplus.com
www.Vidyarthiplus.com
RESULT:
www.Vidyarthiplus.com
www.Vidyarthiplus.com
www.Vidyarthiplus.com
www.Vidyarthiplus.com
PROGRAM:
%PROGRAM FOR BUTTERWORTH FILTER
clear all;
clc;
close all;
format long
rp=input('Enter the ripple of pass band (rp)= ');
rs=input('Enter the ripple of stop band (rs)= ');
wp=input('Enter the frequency of pass band (fp)= ');
ws=input('Enter the frequency of stop band (fs)= ');
fs=input('Enter the sampling frequency (F)= ');
w1=2*wp/fs;
w2=2*ws/fs;
%LOW PASS FILTER
[n,wn]=buttord(w1,w2,rp,rs);
[b,a]=butter(n,wn);
w=0:0.01:pi;
[h,om]=freqz(b,a,w);
m=20*log10(abs(h));
an=angle(h);
disp('Filter order');
disp(n);
disp('Cut-off frequency');
disp(wn);
figure(1);
Subplot(2,1,1);
plot(om/pi,m);
ylabel('Gain in deciBel');
www.Vidyarthiplus.com
www.Vidyarthiplus.com
www.Vidyarthiplus.com
www.Vidyarthiplus.com
[b,a]=butter(n,wn,'bandpass');
w=0:0.01:pi;
[h,om]=freqz(b,a,w);
m=20*log10(abs(h));
an=angle(h);
figure(3);
subplot(2,1,1);
plot(om/pi,m);
ylabel('Gain in deciBel');
xlabel('Normalized frequency in rad/sec');
title('Magnitude Plot (BPF)');
figure(3);
subplot(2,1,2);
plot(om/pi,an);
xlabel('Normalized frequency in rad/sec');
ylabel('Phase Angle in rad');
title('Phase Plot (BPF)');
%BAND STOP FILTER
[n]=buttord(w1,w2,rp,rs);
wn=[w1,w2];
[b,a]=butter(n,wn,'stop');
w=0:0.01:pi;
[h,om]=freqz(b,a,w);
m=20*log10(abs(h));
an=angle(h);
figure(4);
subplot(2,1,1);
plot(om/pi,m);
ylabel('Gain in deciBel');
xlabel('Normalized frequency in rad/sec');
title('Magnitude Plot (BSF)');
www.Vidyarthiplus.com
www.Vidyarthiplus.com
figure(4);
subplot(2,1,2);
plot(om/pi,an);
xlabel('Normalized frequency in rad/sec');
ylabel('Phase Angle in rad');
title('Phase Plot (BSF)');
www.Vidyarthiplus.com
www.Vidyarthiplus.com
www.Vidyarthiplus.com
www.Vidyarthiplus.com
RESULT:
www.Vidyarthiplus.com
www.Vidyarthiplus.com
www.Vidyarthiplus.com
www.Vidyarthiplus.com
PROGRAM:
%chebyshev filter
clear all;
clc;
close all;
rp=input('Enter the pass band ripple:');
rs=input('Enter the stop band ripple:');
wp=input('Enter the pass band frequency:');
ws=input('Enter the stop band frequency:');
fs=input('Enter the sampling frequency:');
w1=2*wp/fs;
w2=2*ws/fs;
%LOW PASS FILTER
[n,wn]=cheb1ord(w1,w2,rp,rs);
[b,a]=cheby1(n,rp,wn);
w=0:0.01:pi;
[h,om]=freqz(b,a,w);
m=20*log10(abs(h));
an=angle(h);
disp('Filter order');
disp(n);
disp('Cut-off frequency');
disp(wn);
subplot(2,1,1);
plot(om/pi,m);
ylabel('Gain in db--->');
xlabel('(a)Normalized frequency--->');
title('Low pass filter');
www.Vidyarthiplus.com
www.Vidyarthiplus.com
subplot(2,1,2);
plot(om/pi,an);
xlabel('(b)Normalized frequency--->');
ylabel('Phase in radians--->');
%HIGH PASS FILTER
[n,wn]= cheb1ord(w1,w2,rp,rs);
[b,a]=cheby1(n,rp,wn,'high');
w=0:0.01:pi;
[h,om]=freqz(b,a,w);
m=20*log10(abs(h));
an=angle(h);
figure(2);
subplot(2,1,1);
plot(om/pi,m);
ylabel('Gain in db--->');
xlabel('(a)Normalized frequency--->');
title('High pass filter');
figure(2);
subplot(2,1,2);
plot(om/pi,an);
xlabel('(b)Normalized frequency--->');
ylabel('Phase in radians--->');
%BAND PASS FILTER
[n]=cheb1ord(w1,w2,rp,rs);
wn=[w1,w2];
[b,a]=cheby1(n,rs,wn,'bandpass');
w=0:0.01:pi;
[h,om]=freqz(b,a,w);
m=20*log10(abs(h));
an=angle(h);
www.Vidyarthiplus.com
www.Vidyarthiplus.com
figure(3);
subplot(2,1,1);
plot(om/pi,m);
ylabel('Gain in db--->');
xlabel('(a)Normalized frequency--->');
title('Band pass filter');
figure(3);
subplot(2,1,2);
plot(om/pi,an);
xlabel('(b)Normalized frequency--->');
ylabel('Phase in radians--->');
%BAND STOP FILTER
[n]=cheb1ord(w1,w2,rp,rs);
wn=[w1,w2];
[b,a]=cheby1(n,rp,wn,'stop');
w=0:0.1/pi:pi;
[h,om]=freqz(b,a,w);
m=20*log10(abs(h));
an=angle(h);
figure(4);
subplot(2,1,1);
plot(om/pi,m);
ylabel('Gain in db--->');
xlabel('(a)Normalized frequency--->');
title('Bandstop filter');
figure(4);
subplot(2,1,2);
plot(om/pi,an);
xlabel('(b)Normalized frequency--->');
ylabel('Phase in radians--->');
www.Vidyarthiplus.com
www.Vidyarthiplus.com
www.Vidyarthiplus.com
www.Vidyarthiplus.com
RESULT:
www.Vidyarthiplus.com
www.Vidyarthiplus.com
www.Vidyarthiplus.com
www.Vidyarthiplus.com
PROGRAM:
% CALCULATION OF FFT AND IFFT
clc;
clear all;
close all;
N=input('Enter the length of sequence(N)= ');
x=input('Enter the input sequence(x)= ');
n=0:1:(N-1);
subplot(2,2,1);
stem(n,x,'k');
xlabel('N--->');
ylabel('Amplitude');
title('Input sequence');
k=0:1:(N-1);
X=fft(x,N);
subplot(2,2,2);
stem(k,abs(X),'k');
xlabel('k--->');
ylabel('Amplitude');
title('Magnitude Plot(FFT)');
subplot(2,2,3);
stem(k,angle(X),'k');
xlabel('k--->');
ylabel('Angle');
title('Phase Plot(FFT)');
n=0:1:(N-1);
x=ifft(X,N);
subplot(2,2,4);
www.Vidyarthiplus.com
www.Vidyarthiplus.com
stem(n,abs(x),'k');
xlabel('n--->');
ylabel('Amplitude');
title('Magnitude Plot');
www.Vidyarthiplus.com
www.Vidyarthiplus.com
RESULT:
www.Vidyarthiplus.com
www.Vidyarthiplus.com
www.Vidyarthiplus.com
www.Vidyarthiplus.com
PROGRAM:
%program for decimation
clc;
close all;
clear all;
N=input('Enter the length of the samples(N)=');
t1=input('Enter the first time period(t1)=');
t2=input('Enter the second time period(t2)=');
D=input('Enter the Down sampling factor(D)=');
n=0:N-1;
X=sin(2*pi*n*t1) + sin(2*pi*n*t2);
Y=decimate(X,D);
subplot(2,1,1);
stem(n,X(1:N),'k');
title('Sample Signal');
xlabel('sample');
ylabel('Amplitude');
d=0:(N/D)-1;
subplot(2,1,2);
stem(d,X(1:N/D),'k');
title('Down sampled signal');
xlabel('Sample');
ylabel('Amplitude');
www.Vidyarthiplus.com
www.Vidyarthiplus.com
RESULT:
www.Vidyarthiplus.com
www.Vidyarthiplus.com
www.Vidyarthiplus.com
www.Vidyarthiplus.com
PROGRAM:
%program for DFT & IDFT
clc;
x1=input('Enter the input sequence ');
N=length(x1);
n=0:1:N-1;
k=0:1:N-1;
WN=exp(-1i*2*pi/N);
nk=n'*k;
WnNK=WN.^nk;
Xk=x1*WnNK;
Xkmag=abs(Xk);
WNnk=WN.^(-nk);
xn=Xk*WNnk/N;
subplot(3,1,1);
stem(n,x1);
xlabel('time period');
ylabel('Amplitude');
title('input sequence');
subplot(3,1,2);
stem(n,Xkmag);
xlabel('time period');
ylabel('Amplitude');
title('DFT');
subplot(3,1,3);
stem(n,xn);
xlabel('time period');
ylabel('Amplitude');
title('IDFT');
www.Vidyarthiplus.com
www.Vidyarthiplus.com
RESULT:
www.Vidyarthiplus.com
www.Vidyarthiplus.com
www.Vidyarthiplus.com
www.Vidyarthiplus.com
PROGRAM:
%Impluse invariant transformation
clc;
close all;
clear all;
b=input('Enter the numerator co-efficient of analog filter = ');
a=input('Enter the denominator co-efficient of analog filter = ');
fs=input('Sampling frequency = ');
[bz,az]=impinvar(b,a,fs);
disp('bz = ');
disp(bz);
disp('az = ');
disp(az);
Hz=tf(bz,az)
%Bilnear transformation transformation
www.Vidyarthiplus.com
www.Vidyarthiplus.com
1.4980 -0.3679
Transfer function:
5.551e-018 s^2 + 0.02904 s - 0.01953
-----------------------------------s^3 - 2.057 s^2 + 1.498 s - 0.3679
Enter the numerator co-efficient of analog filter = [ 2 ]
Enter the denominator co-efficient of analog filter = [1 3 2]
Sampling frequency = 1
bz =
0.1667 0.3333 0.1667
az =
1.0000 -0.3333
0.0000
Transfer function:
0.1667 s^2 + 0.3333 s + 0.1667
-----------------------------s^2 - 0.3333 s + 7.401e-017
RESULT:
www.Vidyarthiplus.com
www.Vidyarthiplus.com
www.Vidyarthiplus.com
www.Vidyarthiplus.com
www.Vidyarthiplus.com
www.Vidyarthiplus.com
www.Vidyarthiplus.com
www.Vidyarthiplus.com
www.Vidyarthiplus.com
www.Vidyarthiplus.com
www.Vidyarthiplus.com
www.Vidyarthiplus.com
www.Vidyarthiplus.com
www.Vidyarthiplus.com
www.Vidyarthiplus.com
www.Vidyarthiplus.com
www.Vidyarthiplus.com
www.Vidyarthiplus.com
www.Vidyarthiplus.com
www.Vidyarthiplus.com
www.Vidyarthiplus.com
www.Vidyarthiplus.com
www.Vidyarthiplus.com
www.Vidyarthiplus.com
www.Vidyarthiplus.com
www.Vidyarthiplus.com
www.Vidyarthiplus.com
www.Vidyarthiplus.com
www.Vidyarthiplus.com
www.Vidyarthiplus.com
www.Vidyarthiplus.com
www.Vidyarthiplus.com
www.Vidyarthiplus.com
www.Vidyarthiplus.com
www.Vidyarthiplus.com
www.Vidyarthiplus.com
www.Vidyarthiplus.com
www.Vidyarthiplus.com
www.Vidyarthiplus.com