Simplify Transfer Function Matrix from State Space Form

9 views (last 30 days)
Hello,
So I am trying to find the transfer function based on a given state space.
I have 4 state space variables and 2 input variables
I solve for the matrix by solving for it via:
M=inv(s*eye(4)-A)*B(:,1) where s is the transfer function variable
A and B are a 4x4 and a 4x2 matrix, respectively.
I only want to know the transfer function of the last state variable based on the 1st input and so I ran the code to get M(4)
The result is:
(291092572962188544*(52192918614186625698444518236820348728735495618560*s^2 + 11252397011746677728245236731359753030204089434112*s + 444373219855405652822261463840068999419504203635))/(67399866667876599486667537717549076684092861056351431202759025623040*s^4 + 42464278741089363000296954579309245873406204871934648171073988722688*s^3 + 2297488914641467386088601099487479294998500605751388518061919174656*s^2 - 2440319864177907270599586997470126899570878247883142511440169009152*s - 349746435404782601645659492711056495443542480131034307368768072445) + (179449926349046518120448*(16703017991267559745434935388614455463159204413440*s^2 + 9694255099214075385675054328905457782285043499008*s + 1200327659673728889951461375690725495294778934073))/(78125*(67399866667876599486667537717549076684092861056351431202759025623040*s^4 + 42464278741089363000296954579309245873406204871934648171073988722688*s^3 + 2297488914641467386088601099487479294998500605751388518061919174656*s^2 - 2440319864177907270599586997470126899570878247883142511440169009152*s - 349746435404782601645659492711056495443542480131034307368768072445)) + (12453065286370507543289888743877440*(81129638414606681695789005144064*s^2 + 54732842176865668872273383129088*s + 8898770669723102454779195279849))/(67399866667876599486667537717549076684092861056351431202759025623040*s^4 + 42464278741089363000296954579309245873406204871934648171073988722688*s^3 + 2297488914641467386088601099487479294998500605751388518061919174656*s^2 - 2440319864177907270599586997470126899570878247883142511440169009152*s - 349746435404782601645659492711056495443542480131034307368768072445) - (498460498419343452338927647605129216*(5*s + 1)*(9007199254740992*s + 2461747390280677)*(9007199254740992*s + 3614818768512437))/(125*(67399866667876599486667537717549076684092861056351431202759025623040*s^4 + 42464278741089363000296954579309245873406204871934648171073988722688*s^3 + 2297488914641467386088601099487479294998500605751388518061919174656*s^2 - 2440319864177907270599586997470126899570878247883142511440169009152*s - 349746435404782601645659492711056495443542480131034307368768072445))
How Can I simplify this line of code to get my answer with decimals vs these awful integers?
I tried using 'format', but that didn't change. I still want my output to be in terms of s of course.
Future thanks!

Accepted Answer

Paul
Paul on 8 May 2022
Edited: Paul on 8 May 2022
Hi Diego,
It looks like the code used the Symbolic Math Toolbox? If so, there's no need to go that route unless you really need extended precision. Have you tried using the Control Systems Toolbox?
If you want the TF to the last state variable from the first input, try:
tf(ss(A,B(:,1),[0 0 0 1],0))
or
sys = ss(A,B,[0 0 0 1],0);
tf(sys(1,1))
If the symbolic approach is desired then
M = vpa([0 0 0 1]*inv(s*eye(4)-A)*B(:,1))
See the doc page for vpa() to see how to control the number of digits in each term in the result.

More Answers (0)

Categories

Find more on Symbolic Math Toolbox in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!