0% found this document useful (0 votes)
85 views2 pages

State Space To Transfer Function: Sample - ss2tf.m

This document provides code that demonstrates how to convert a multiple input multiple output (MIMO) system from state space form to transfer function form in MATLAB. The code defines system matrices A, B, C and D and uses the ss2tf function to obtain the transfer functions relating each input to each output.

Uploaded by

Vinoy Nambiar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
85 views2 pages

State Space To Transfer Function: Sample - ss2tf.m

This document provides code that demonstrates how to convert a multiple input multiple output (MIMO) system from state space form to transfer function form in MATLAB. The code defines system matrices A, B, C and D and uses the ss2tf function to obtain the transfer functions relating each input to each output.

Uploaded by

Vinoy Nambiar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

4/6/2014

File Exchange - MATLAB Central


Search: File Exchange Create Account Log In

File Exchange

Answ ers

New sgroup

Link Exchange

Blogs

Trendy

Cody

Contest

MathWorks.com

Dow nload Submission

Code covered by the BSD License

Highlights from State Space to Transfer Function


sample_ss2tf.mA simple code demonstrating ss2tf functionality in matlab View all files

State Space to Transfer Function


by Avinash Parnandi 21 Apr 2011 This code demonstrates how to convert a MIMO system from state space form to Transfer function form.

sam ple_ss2tf.m

% %As i m p l ec o d ed e m o n s t r a t i n gs s 2 t ff u n c t i o n a l i t yi nm a t l a b %T h i sc o d ed e m o n s t r a t e sh o wt oc o n v e r tam u l t ii n p u tm u l t io u t p u t( M I M O ) %s y s t e mf r o ms t a t es p a c ef o r m( A , B , C , D )t ot r a n s f e rf u n c t i o nf o r m .Y o uc a n %u s et h es a m ec o n c e p t sf o ras i n g l ei n p u ts i n g l eo u t p u ts y s t e m . %T h i sc o d ed e m o n s t r a t e sh o wt ou s et h eb u i l ti nf u n c t i o n' s s 2 t f 'a n d' t f ' % %c o n s i d e ra2i n p u t ,2o u t p u ts y s t e m , A=[ 1 . 1 0 0 8 0 . 3 7 3 3 0 . 3 7 3 3 0 . 9 5 6 1 ] ; B=[0 . 7 2 5 4 0 . 7 1 4 7 0 0 . 2 0 5 0 ] ; C=[0 . 1 2 4 1 1 . 4 0 9 0 1 . 4 8 9 7 1 . 4 1 7 2 ] ; D=[0 . 6 7 1 5 1 . 2 0 7 5 0 . 7 1 7 2 0 ] ;

%%y o uc a nu s e' r s s 'a n d' s s d a t a 't og e tr a n d o mA ,B ,C ,Dm a t r i c e s %s y s=r s s ( 2 , 2 , 2 )%t og e n e r a t ear a n d o m2 x 2s y s t e m %[ A , B , C , D ]=s s d a t a ( s y s ) ;%t op r o v i d eA ,B ,C ,Dm a t r i c e sf o rt h i ss y s t e m % %o n c ew eh a v et h eA ,B ,C ,Dm a t r i xw ec a nu s es s 2 t ff u n c t i o nt og e tt h e %t r a n s f e rf u n c t i o n ( s ) %B e c a u s et h e r ea r e2i n p u t sa n d2o u t p u t s ,t h eT r a n s f e rf u n c t i o nm a t r i x . . . %w i l lh a v e4t r a n s f e rf u n c t i o n s : %T F 1=i n p u t1t oo u t p u t1 %T F 2=i n p u t1t oo u t p u t2 %T F 3=i n p u t2t oo u t p u t1 %T F 4=i n p u t2t oo u t p u t2 %T F=[ T F 1T F 2 % T F 3T F 4 ] ; % %S S 2 T F %S y n t a xf o rs s 2 t fi s :[ n u md e n ]=s s 2 t f ( A , B , C , D , i u ) %h e r ei uc o r r e s p o n d st ot h ei n p u tw ea r ec o n s i d e r i n ge . g .w h e nw eh a v e2 %i n p u t s ,f i r s tw ew i l lc o n s i d e ri u = 1( f i r s ti n p u t ) ,t h i sw a y %w ew i l lg e tt h et r a n s f e rf u n c t i o n sf r o mi n p u t1t oo u t p u t1a n di n p u t1t oo u t p u t2 . %T h e nw ew i l lt a k ei u=2 ,t h i sw i l lg i v eu st r a n s f e rf u n c t i o n sf r o mi n p u t %2t oo u t p u t1a n di n p u t2t oo u t p u t2 . %h e n c e' i u 'w i l lg of r o m1t o2 [ n u m 1d e n 1 ]=s s 2 t f ( A , B , C , D , 1 ) %i u=1 [ n u m 2d e n 2 ]=s s 2 t f ( A , B , C , D , 2 ) %i u=2 %T h et r a n s f e rf u n c t i o nw i l lb eg i v e nb yn u m 1 / d e n 1a n dn u m 2 / d e n 2 %h e r et h en u ma n dd e n o m i n a t o ra r ep o l y n o m i a l si nd e c r e a s i n gp o w e r so f' s ' . . . %e . g .s ^ 2 + 0 . 5 s + 2 % %T F %t h es a m er e s u l tc a nb eo b t a i n e du s i n gf u n c t i o nt f s y s=s s ( A , B , C , D ) ; t f ( s y s )

Contact us

http://www.mathworks.in/matlabcentral/fileexchange/31139-state-space-to-transfer-function/content/sample_ss2tf.m

1/2

4/6/2014
1994-2014 The MathWorks, Inc.

File Exchange - MATLAB Central


Site Help Featured MathWorks.com Topics: Patents New Products Trademarks Support Privacy Policy Documentation Preventing Piracy Training Terms of Use Newsletters MATLAB Trials Careers

Webinars

http://www.mathworks.in/matlabcentral/fileexchange/31139-state-space-to-transfer-function/content/sample_ss2tf.m

2/2

You might also like