Академический Документы
Профессиональный Документы
Культура Документы
Aditya Sengupta
// D e f i n i n g a f i r s t o r d e r s y s t e m :
s = %s // The q u i c k e r a l t e r n a t i v e t o u s i n g s =
poly (0 , s )
K = 1, T = 1 // G a i n and t i m e c o n s t a n t
SimpleSys = s y s l i n ( c , K /(1+ T * s ) )
fMin = 0 . 0 1 , fMax=10
bode ( SimpleSys , fMin , fMax )
p=s2+9 * s+9
O v e rd a mp e d S y s t e m= s y s l i n ( c , 9/ p )
roots (p)
p=s2+9 * s+9
O v e rd a mp e d S y s t e m= s y s l i n ( c , 9/ p )
roots (p)
y4 = c s i m ( s t e p , t , Ov e rd a mp ed S ys t em ) ;
p l o t ( t , y4 )
q=s2+2 * s+9
U n d er d am p e d S y s t e m = s y s l i n ( c , 9/ q )
roots (q)
r = s2+9
Unda mpedS ys te m = s y s l i n ( c , 9/ r )
roots (r)
m = s2+6 * s+9
C r i t i c a l l y D a m p e d S y s t e m = s y s l i n ( c , 9/ m )
roots (m)
z = %z
a = 0.1
DTSystem = s y s l i n ( d , a * z / ( z (1a ) ) )
A = [ 0 , 1 ; 1, 0. 5]
B = [ 0 ; 1]
C = [1 , 0]
D = [0]
x0 = [ 1 ; 0 ] // The i n i t i a l state
SSsys = s y s l i n ( c , A , B , C , D , x0 )
scf ( 1 ) ; p l o t ( t , y )
e v a n s ( SSsys ) // zoom i n
// C o n v e r s i o n from s t a t e s p a c e t o t r a n s f e r f u n c t i o n :
s s 2 t f ( SSsys )
r o o t s ( denom ( a n s ) )
spec (A)
e v a n s ( SSsys ) // zoom i n
// C o n v e r s i o n from s t a t e s p a c e t o t r a n s f e r f u n c t i o n :
s s 2 t f ( SSsys )
r o o t s ( denom ( a n s ) )
spec (A)
SubSys1 = s y s l i n ( c , 1/ s )
SubSys2 = 2 // System w i t h g a i n 2
Series = SubSys1 * SubSys2
Parallel = SubSys1+SubSys2
Feedback = SubSys1 / . SubSys2 // Note s l a s h dot , n o t dots l a s h
// A l s o t r y t h e a b o v e s t e p u s i n g 2 i n s t e a d o f S u b s y s 2
SubSys1 = s y s l i n ( c , 1/ s )
SubSys2 = 2 // System w i t h g a i n 2
Series = SubSys1 * SubSys2
Parallel = SubSys1+SubSys2
Feedback = SubSys1 / . SubSys2 // Note s l a s h dot , n o t dots l a s h
// A l s o t r y t h e a b o v e s t e p u s i n g 2 i n s t e a d o f S u b s y s 2
X (s) 1
=
F (s) ms 2 + bs + k
We will use a scaling factor of k and represent the system as:
k
G (s) =
ms 2 + bs + k
m = 1 // Mass : kg
b = 10 // Damper : Ns/m
k = 20 // S p r i n g : N/m
s = %s
// System :
System = k / ( m * s 2 + b * s + k )
// We u s e k a s o u r s c a l i n g f a c t o r .
n2
s 2 + 2n s + n2
We have r
k
n =
m
and
b/m
=
2n
wn = s q r t ( k / m )
zeta = ( b / m ) / ( 2 * wn )
Rs = 1/ s
Gs = System
// The s t e a d y s t a t e v a l u e o f t h e s y s t e m i s :
css = h o r n e r ( s * System * Rs , 0 )
Rs = 1/ s
Gs = System
// The s t e a d y s t a t e v a l u e o f t h e s y s t e m i s :
css = h o r n e r ( s * System * Rs , 0 )
The root locus is the plot of the location of the poles of:
KG (s)
1 + KG (s)
as k varies.
That is to say, we need to find the solution of the denominator
going to zero:
1 + KG (s) = 0
or
1
K=
G (s)
We can find the location of a given point on the root locus using
the locate() command.
We then need to multiply the [x; y] coordinates returned by this
command with [ 1, % i ] so that we obtain the position in the
complex plane as x + iy
We then simply evaluate -1/G(s) at the given position using
horner()
(Choose any point on the root locus right now, we will shortly see
how to decide which point to choose)
4
n =
Ts
zeta = s q r t ( ( l o g ( OS ) ) 2 / ( ( l o g ( OS ) ) 2 + %pi 2 ) )
wn = 4 / ( zeta * Ts )