Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
47 views

Control Engineering Lab (MATLAB) # 1: System

This document discusses control systems and provides examples of MATLAB code. It defines a system as interconnections of elements and devices, and a control system as interconnections that provide a desired response. Open loop systems have no effect of output on input, while closed loop systems have output affecting input to maintain the desired output value. Transfer functions are provided for open and closed loop systems. MATLAB examples demonstrate matrix operations like inverse, transpose, size and calling elements. Polynomial functions, partial fractions, plotting, and subplots are also illustrated.

Uploaded by

Engr Bilal Khan
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
47 views

Control Engineering Lab (MATLAB) # 1: System

This document discusses control systems and provides examples of MATLAB code. It defines a system as interconnections of elements and devices, and a control system as interconnections that provide a desired response. Open loop systems have no effect of output on input, while closed loop systems have output affecting input to maintain the desired output value. Transfer functions are provided for open and closed loop systems. MATLAB examples demonstrate matrix operations like inverse, transpose, size and calling elements. Polynomial functions, partial fractions, plotting, and subplots are also illustrated.

Uploaded by

Engr Bilal Khan
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

Control Engineering Lab (MATLAB) # 1

System:
A system is an interconnection of elements and devices for desired purposes.

Control System:
A control system is an interconnection of components forming a configuration that will
provide a desired response.

Types of Control Systems:


1) Open Loop Control System:
An open loop control system is a system in which output has no effect on input.

2) Closed Loop Control System:


A closed loop control system is a system in which output has effect on input quantity in
such a manner as to maintain the desired output value.

Transfer

Function for
Loop:

Open

Y(s) = G(s) X(s)


G(s) = Y(s) X(s)
Transfer Function = (Laplace Transform of Output) (Laplace
Transform of Input)

Transfer Function for Closed Loop:

Transfer Function = G(s) / [1+G(s)H(s)]

MATRIX
SQUARE MATRIX:
a=[1 2;4 5]
a=
1

COLUMN MATRIX:
a=[1;2]
a=

1
2
ROW MATRIX:
a=[1 2]
a =1

INVERSE OF MATRIX:
a=[1 2;4 5]
inv(a)
ans =
-1.6667

0.6667

1.3333 -0.3333
LENGTH OF MATRIX:
a=[1 2;4 5]
length(a)
ans =
2
TRANSPOSE OF MATRIX:
a=[1 2;4 5]
a'
ans =
1

4
2

CALL A COLUMN:
a=[1 2;4 5]
a(:,2)

ans =
2
5
SIZE OF MATRIX:
a=[1 2;4 5]
size(a)
ans =

CALL A ROW:
a=[1 2;4 5]
a(1,:)
ans =
1

MAGIC FUNCTION:
magic(3)
ans =
8

SIMPLE VECTOR OPERATIONS:


x=[1 2;3 4]
y=[2 4;6 8]
z=x+y
z=

x=[1 2;3 4]
y=[2 4;6 8]
z=x-y
z=

x=[1 2;3 4]
y=[2 4;6 8]
z=x.*y
z=

x=[1 2;3 4]
y=[2 4;6 8]
z=x./y
z=

-1

-2

0.5000

0.5000

12

-3

-4

18

32

0.5000

0.5000

SOLVING LINEAR EQUATIONS:


ax=b
x=(a^-1)b
Solution in MATLAB
a=[1 4;5 8]
b=[2;8]
x=inv(a)*b
x=
1.3333
0.1667
POLYNOMIAL FUNCTION:

P=x^3-x+2
p=[1 0 -1 2]
polyval(p,0)
ans =
2
Similarly, at x=5

For Multiplication, let

To Find q:

For Derivation:

q=x^2+2x+1

deconv(z,p)
ans =

polyder(p)
ans =

p=[1 0 -1 2]
q=[1 2 1]
conv(p,q)

z=ans =

p=[1 0 -1 2]
polyval(p,5)
ans =

To Find P:

For Integration:

deconv(z,q)
ans =

polyint(p)
ans =

-1

122

PARTIAL FRACTION:
f(x)=(-4x+8)/(x^2+6x+8)
b=[-4 8]
a=[1 6 8]
[r,p,k]=residue(b,a)
r=

-12
8
p=

-4
-2
k=

[]
(-4x+8)/(x^2+6x+8)=k+(r/(x-p))=(-12/(x+4))+(8/(x+2))

0.25

-1

0 -0.5 2.0 0

PLOT:
4

3.5

a=[1 2 3 4]
plot(a)

2.5

1.5

1.5

2.5

3.5

3.5

a=[1 2 3 4]
plot(a,'o')

2.5

1.5

1.5

2.5

3.5

7.5
7
6.5

x=[1 2 3 4]
y=[3 5 7 8]
plot(x,y,'o')

6
5.5
5
4.5
4
3.5
3

SUBPLOT:

1.5

2.5

3.5

1
0.8
0.6

subplot(2,2,2)

0.4
0.2
0

0.5

You might also like