0% found this document useful (0 votes)
16 views

Matlab: - Matrix Laboratory

1) MATLAB is a matrix laboratory program that contains tools for tasks like control systems. To use MATLAB, you open the command window and type commands. For example, typing "demo" shows demonstrations of MATLAB functions. 2) MATLAB can be used to input matrices and perform operations on them like multiplication and evaluation. Transfer functions can also be entered as numerator and denominator polynomials. 3) Block diagrams can be represented in MATLAB and operations like feedback, series, and parallel combinations can be used to analyze and reduce systems.

Uploaded by

Tushar Gupta
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views

Matlab: - Matrix Laboratory

1) MATLAB is a matrix laboratory program that contains tools for tasks like control systems. To use MATLAB, you open the command window and type commands. For example, typing "demo" shows demonstrations of MATLAB functions. 2) MATLAB can be used to input matrices and perform operations on them like multiplication and evaluation. Transfer functions can also be entered as numerator and denominator polynomials. 3) Block diagrams can be represented in MATLAB and operations like feedback, series, and parallel combinations can be used to analyze and reduce systems.

Uploaded by

Tushar Gupta
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 65

MATLAB

- Matrix Laboratory

Contains base program plus tool boxes


(e. g. Control System Tool box)

To invoke matlab

type cd\matlab\bin
at DOS prompt

C:\

> cd\matlab\bin

C:\MATLAB\BIN

Now type

matlab

Matlab prompt will appear as

for demo, type demo on getting the prompt

demo

Now select your option &

self learn.

e. g. , for basic matlab commands, choose option 1 and enter

how to input a matrix

A =

[1 b 2 ;4 b 6 ]

The computer will respond as :

A =

1 2 4 6

If you type
A = [ 1 b 2 ; 4 b 6 ] ;

The screen output will be suppressed

Multiply two polynomials in s

p (s) = 2s + 1 q (s) = s + 4

2+ 3s

>> p = [ 3 2 1 ]; >> q = [ 1 4 ] ; >> n = conv ( p, q ) n = 3 14 9 4

Evaluate n (s) at s = - 5

value =
polyval ( n, - 5 )

value = - 66

G1

G2
2) s

G1 = 1 / (500

G2 = ( s +1 ) / ( s + 2 )

To input a transfer function

ng1 = [1] ; dg1 = [ 500 0 0];

printsys ( ng1, dg1 )


num / den =

1 500 s 2

ng2 = [1 1] ; dg2 = [ 1 2];

>>

[ ng3, dg3 ] = series ( ng1,dg1,ng2,dg2 )

ng3 = 0 0 1 1 dg3= 500 1000 0

G1

+
G2 +

>>
ng4 dg4

[ ng4, dg4 ] = parallel ( ng1,dg1,ng2,dg2 )


= 500 = 500

500 1000

1 0

1 s+1

>> ng = [1]; >> dg = [1 1] ; > > [nt, dt] = cloop (ng , dg, -1)

.... .

nt

0 dt >> = 1

1 2

1 s+1

[nt, dt ] = cloop ( ng, dg, 1 )


>>

nt =
0 1
0

dt =
1

> >

G = 1/ (500

2) s

H = (s + 1) / (s + 2)

> > ng = [ 1 ]; > > dg = [ 500 0 0 ];

> > nh = [ 1 1]; > > dh = [ 1 2];

> > [ nt, dt ] = feedback ( ng, dg, nh, dh, -1)

nt =
0 0 1 2

dt = 500 1000 1 1

H2
_

R +
_

G1

G2

+ +

G3

G4

H1

G1 = 1 / ( s + 10 )
>> ng1 = [1]; >> dg1 = [ 1 10 ];

G2 = 1 / ( s + 1 )

ng2 = [1] ; dg2 = [ 1 1 ];

G3 = ( + 1 ) / 2 +4s +4 ) (s
2 s

ng3 = [ 1 0 1 ]; dg3 = [ 1 4 4 ];

G4 = ( s +1 ) / ( s + 6 )

>> ng4 = [ 1 1 ];
>> dg4 = [1 6 ];

H1 = ( s + 1 ) / ( s + 2 )

nh1 = [1 1] ; dh1 = [1 2 ];

H2 = 2

nh2 = [ 2 ]; dh2 = [ 1 ];

H2
_

R +
_

G1

G2

+ +

G3

G4

H1

Steps in reduction :
Move H2 ahead of G4
Eliminate G3 G4 H1 loop

eliminate H 2 loop
eliminate the third loop

H2
_

R +
_

G1

G2

+ +

G3

G4

H1

Move H2 ahead of G4 Find H2 / G4

>> n1 = conv ( nh2, dg4 ) ; >> d1 = conv ( dh2, ng4 ) ;

>> printsys (n1,d1)

num / den =
2s +12 -------s+1

eliminate G3 G4 H1 loop

H2 / G4
_

R +
_

G1

G2

+ +

G3

G4

H1

[ n2 , d2 ] = series
(ng3 , dg3 ,ng4, dg4);

>> [ n3, d3 ] = feedback (n2, d2, nh1, dh1, +1) ;

eliminate H2 loop

H2 / G4 R + -

G1

G2

>> [ n4, d4 ] = series ( ng2,dg2,n3,d3 );

>> [n5, d5] = feedback ( n4,d4, n1,d1 ) ;

eliminate the third loop

+ -

G1

>> [ n6, d6 ] = series (n5,d5,ng1,dg1) ;

[ nt, dt ] = cloop
( n6, d6, -1 );

>> printsys ( nt,dt )

num / den =
s^5+4s^4+6s^3+6s^2+5s+2 --------------------------------------------------------------------12s^6 +205s^5 +1066s^4 + 2517s^3+ 3128s^2+2196s+712

You might also like