Apse Lab

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 6

Problem 1

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.

PROGRAM for addition of five numbers when prompted for:


s=0
for i = 1:5,
a(i)= input('enter no.');
s = s + a(i);
end
s

OUTPUT:
s=

enter no.1
enter no.2
enter no.3
enter no.4
enter no.5

s=

15

STEPS TO MAKE EXECUTABLE FILE:

1. Make a .m file in MATLAB.


2. Save this file with the name “addition” in C drive.
3. Navigate to matlabroot\extern\examples\compiler. Matlabroot is the matlabroot folder. To
find the value of the variable on your system, type matlabroot at a matlab command prompt.
4. Create a work folder named work (D:\work). Create a subfolder in the work folder and
name it addition (D:\work\addition). Avoid using spaces in your folder name, if possible.
5. Copy addition.m from matlabroot\extern\examples\compiler to D:\work\addition.
6. At the matlab command prompt, change your working folder to D:\work\addition.

Page | 6

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy