Apse Lab
Apse Lab
Apse Lab
Write matlab program for LOW PASS FILTER with cut off frequency 1KHz.
Solution:-
Ckt dia.
MATLAB PROGRAM
clc;
f=input('input the value of cut off frequency for low pass filter ')
RC=inv(2*pi*f)
y=0:.1:10;
w=10.^y;
y=(1./sqrt(1+(2.*pi.*w.*RC).^2));
semilogx(w,y)
SOLUTION
input the value of cut off frequency for low pass filter 1000
f= 1
1000 0.9
RC = 0.8
X: 1000
Y: 0.7071
1.5915e-004 0.7
0.6
0.5
0.4
0.3
0.2
0.1
Page | 1
0
0 1 2 3 4 5 6 7 8 9 10
10 10 10 10 10 10 10 10 10 10 10
Problem 2
Write matlab program for HIGH PASS FILTER with cut off frequency 100 KHz.
Solution:-
Ckt dia.
MATLAB PROGRAM
clc;
f=input('input the value of cut off frequency for low pass filter ')
RC=inv(2*pi*f)
y=0:.1:10;
w=10.^y;
y=((2.*pi.*w.*RC)./sqrt(1+(2.*pi.*w.*RC).^2));
semilogx(w,y)
SOLUTION
input the value of cut off frequency for low pass filter 100000
f=
1
100000
0.9
RC =
0.8
X: 1e+005
1.5915e-006 Y: 0.7071
0.7
0.6
0.5
0.4
0.3
0.2
0.1
Page | 2
0
0 1 2 3 4 5 6 7 8 9 10
10 10 10 10 10 10 10 10 10 10 10
Problem 3
Write matlab program for HIGH PASS FILTER with cut off frequency 100 KHz.
Solution:-
Ckt dia.
MATLAB PROGRAM
clc;
f1=input('input the value of upper cut off frequency for band pass filter ');
f2=input('input the value of lower cut off frequency for band pass filter ');
r1c1=inv(2*pi*f1)
r1=100
c1=inv(2*pi*f1)/2
r2c2=inv(2*pi*f2)
r2=10
c2=inv(2*pi*f2)/2
y=0:.1:10;
w=10.^y;
y=(1./sqrt(((((r2./r1)+((c1+c2)./c2)).^2)+((r2.*c1.*2.*pi.*w)+1./(r1.*c1.*2.*pi.*w)-((c1+c2)./
(c1.*c2.*r1.*2.*pi.*w))).^2)));
semilogx(w,y)
SOLUTION
input the value of upper cut off frequency for band pass filter 60000
input the value of lower cut off frequency for band pass filter 50000
r1c1 =
2.6526e-006
r1 =
100
Page | 3
c1 =
1.3263e-006
r2c2 =
3.1831e-006
r2 =
10
c2 =
1.5915e-006
For
0.7
0.6
0.5
0.4
0.3
0.2
0.1
0
0 2 4 6 8 10
10 10 10 10 10 10
Page | 4
input the value of upper cut off frequency for band pass filter 100
input the value of lower cut off frequency for band pass filter 100000
-3
x 10
1
0.9
0.8
0.7
0.6
0.5
0.4
0.3
0.2
0.1
0
0 1 2 3 4 5 6 7 8 9 10
10 10 10 10 10 10 10 10 10 10 10
Program 4:
Write MATLAB program to add the five numbers given when prompted for. Convert the program
Page | 5
Into executable file and run it without matlab environment.
OUTPUT:
s=
enter no.1
enter no.2
enter no.3
enter no.4
enter no.5
s=
15
Page | 6