Large numerator and denominator in symbolic matrix inverse?

5 views (last 30 days)
Hi Mathworks/MATLAB gurus - Happy Thanksgiving to all.
I'm an aerospace professor, and I'm trying to automate the writing of exam questions for my finals. One of the things that I've never particularly been any good at in MATLAB is the handling of symbolic expressions. Fundamentally, I've got a state-space system with an [A] and [B], and I'd like to develop the transfer functions for the system (just for state variables, so no [C] and [D] matrix for this case.
For my purposes, I'd like to produce all the intermediate steps, and I've previously managed to do this with Wolfram Alpha pretty well - see attached figure.
I've tried to do the same in MATLAB, but I cannot get it to yield sensible values - each element of my matrix has a large value in both the numerator and denominator. For example, this is a MnWE (minimum nonworking example) for what I'm talking about
Alon = [-0.0148000000000000,-0.0294562647754137,0,-9.80665000000000;
-0.160000000000000,-0.519148936170213,128.930400000000,0;
0.00189357979188772,-0.0429153529115032,-0.874000000000000,0;
0,0,1,0];
syms s
% Inverse of sI - A - full form
invA = inv(s*eye(size(Alon)) - Alon)
vpa(invA, 4)
Produces
[ (5.907e+18*(20.0*s + 9.0))/(1.181e+20*s^2 + 7.059e+19*s + 1.111e+21), -1.523e+22/(1.181e+20*s^2 + 7.059e+19*s + 1.111e+21)]
[ 8.554e+18/(1.181e+20*s^2 + 7.059e+19*s + 1.111e+21), (5.586e+15*(21150.0*s + 3121.0))/(1.181e+20*s^2 + 7.059e+19*s + 1.111e+21)]
And I cannot seem to get MATLAB to factorise the output for me to a sensible value. I suspect I'm not using some common function, or I'm ging about this the wrong way.
How can I get the output from MATLAB to be in a usable form like that from Mathematica?
Thanks in advance,
Harry

Answers (0)

Categories

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

Products


Release

R2019b

Community Treasure Hunt

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

Start Hunting!