# Thread: Inversion and finding a set of TF in MATLAB 7.5.0

1. ## Inversion and finding a set of TF in MATLAB 7.5.0

I am trying to invert a given matrix and then multiply it by a second matrix to create 3 numeric Transfer Functions using MATLAB 7.5.0 I feel that my code is correct but when i run it i get numeric coefficents of S that are on the order of 11,771,381,206,853,467,500 i would like to get these coefficents reduced to orders of 10^1 or less. Is there some MATLAB function to reduce these co-efficents or do i have to do it by hand? I have attached my code and its output. Any help would be greatly appreciated.
MATLAB M FILE
clc
clear
format short eng
format compact
syms S

Xu=-.0123+0.0085;
Uo=876;
Xt=-32.17*cos(0.04537);
Zu=-0.1118;
Zq=0;
Zt=-32.17*sin(0.04537);
Mu=-0.0026;
Mq=-0.4852;
Xd=12.3976;
Zd=-49.5906;
Md=-11.4124;
Zw=-468.6307/Uo;
Mw=-7.8706/Uo;
Xw=-4.9591/Uo;
A=S-Xu;
B=-Xw*Uo;
C=-Xt;
D=(-1/Uo)*Zu;
E=S-Zw;
F=S-(-1/Uo)*Zt;
G=-Mu;
H=-Uo*Mw;
I=S^2-Mq*S;
J=Xd;
K=(-1/Uo)*Zd;
L=Md;

N=[A B C; D E F; G H I]
M=inv(N);
O=M*[J;K;L]

MATLAB OUTPUT
N =
[ S+19/5000, 49591/10000, 4522865987400279*2^(-47)]
[ 4708552482741387*2^(-65), S+1204637583273045/2251799813685248, S-240036055818929/144115188075855872]
[ 13/5000, 39353/5000, S^2+1213/2500*S]
O =
279169133701442306048*(720575940379279360000*S^3+7 35107472919400745472*S^2-5484328146619850071936*S+9446138904642312937)/(16225927682921336339157801028812800000000*S^4+166 14807230780501961378636831601459200000*S^3-123443458541311479572950570629458267471872*S^2-1408120642774137245176526948273804541952*S-201040921881819649518191926112971291323)-2088550471830367232*(2181035245321584640000*S^2+10 58238301030032867328*S-111242715751351987179375)/(16225927682921336339157801028812800000000*S^4+166 14807230780501961378636831601459200000*S^3-123443458541311479572950570629458267471872*S^2-1408120642774137245176526948273804541952*S-201040921881819649518191926112971291323)+934903808 *(5383117040533337733900823854841856*S+34068949925 11982380371323097183283)/(16225927682921336339157801028812800000000*S^4+166 14807230780501961378636831601459200000*S^3-123443458541311479572950570629458267471872*S^2-1408120642774137245176526948273804541952*S-201040921881819649518191926112971291323)
-2181008857042518016*(11771381206853467500*S^2-234096198796658868577*S+399419996882697856)/(16225927682921336339157801028812800000000*S^4+166 14807230780501961378636831601459200000*S^3-123443458541311479572950570629458267471872*S^2-1408120642774137245176526948273804541952*S-201040921881819649518191926112971291323)+208855047 1830367232*(439804651110400000000*S^3+215064474392 985600000*S^2+810894223531311104*S-36748286147627266875)/(16225927682921336339157801028812800000000*S^4+166 14807230780501961378636831601459200000*S^3-123443458541311479572950570629458267471872*S^2-1408120642774137245176526948273804541952*S-201040921881819649518191926112971291323)+57062*(32 45185536584267267831560205762560000*S^2+6926573581 312154505379064187977728*S-13330634420839389668941552689815021)/(16225927682921336339157801028812800000000*S^4+166 14807230780501961378636831601459200000*S^3-123443458541311479572950570629458267471872*S^2-1408120642774137245176526948273804541952*S-201040921881819649518191926112971291323)
-1090504428521259008*(71282502283170598029+47961534 5916448342016*S)/(16225927682921336339157801028812800000000*S^4+166 14807230780501961378636831601459200000*S^3-123443458541311479572950570629458267471872*S^2-1408120642774137245176526948273804541952*S-201040921881819649518191926112971291323)-18371084231796319275233371488256*(393530000*S+8507 31)/(16225927682921336339157801028812800000000*S^4+166 14807230780501961378636831601459200000*S^3-123443458541311479572950570629458267471872*S^2-1408120642774137245176526948273804541952*S-201040921881819649518191926112971291323)-501922660033232896*(368934881474191032320000*S^2+1 98769774193057618722816*S+516495896073503509923)/(16225927682921336339157801028812800000000*S^4+166 14807230780501961378636831601459200000*S^3-123443458541311479572950570629458267471872*S^2-1408120642774137245176526948273804541952*S-201040921881819649518191926112971291323)

2. Originally Posted by buckeye
I am trying to invert a given matrix and then multiply it by a second matrix to create 3 numeric Transfer Functions using MATLAB 7.5.0 I feel that my code is correct but when i run it i get numeric coefficents of S that are on the order of 11,771,381,206,853,467,500 i would like to get these coefficents reduced to orders of 10^1 or less. Is there some MATLAB function to reduce these co-efficents or do i have to do it by hand? I have attached my code and its output. Any help would be greatly appreciated.
MATLAB M FILE
clc
clear
format short eng
format compact
syms S

Xu=-.0123+0.0085;
Uo=876;
Xt=-32.17*cos(0.04537);
Zu=-0.1118;
Zq=0;
Zt=-32.17*sin(0.04537);
Mu=-0.0026;
Mq=-0.4852;
Xd=12.3976;
Zd=-49.5906;
Md=-11.4124;
Zw=-468.6307/Uo;
Mw=-7.8706/Uo;
Xw=-4.9591/Uo;
A=S-Xu;
B=-Xw*Uo;
C=-Xt;
D=(-1/Uo)*Zu;
E=S-Zw;
F=S-(-1/Uo)*Zt;
G=-Mu;
H=-Uo*Mw;
I=S^2-Mq*S;
J=Xd;
K=(-1/Uo)*Zd;
L=Md;

N=[A B C; D E F; G H I]
M=inv(N);
O=M*[J;K;L]

MATLAB OUTPUT
N =
[ S+19/5000, 49591/10000, 4522865987400279*2^(-47)]
[ 4708552482741387*2^(-65), S+1204637583273045/2251799813685248, S-240036055818929/144115188075855872]
[ 13/5000, 39353/5000, S^2+1213/2500*S]
O =
279169133701442306048*(720575940379279360000*S^3+7 35107472919400745472*S^2-5484328146619850071936*S+9446138904642312937)/(16225927682921336339157801028812800000000*S^4+166 14807230780501961378636831601459200000*S^3-123443458541311479572950570629458267471872*S^2-1408120642774137245176526948273804541952*S-201040921881819649518191926112971291323)-2088550471830367232*(2181035245321584640000*S^2+10 58238301030032867328*S-111242715751351987179375)/(16225927682921336339157801028812800000000*S^4+166 14807230780501961378636831601459200000*S^3-123443458541311479572950570629458267471872*S^2-1408120642774137245176526948273804541952*S-201040921881819649518191926112971291323)+934903808 *(5383117040533337733900823854841856*S+34068949925 11982380371323097183283)/(16225927682921336339157801028812800000000*S^4+166 14807230780501961378636831601459200000*S^3-123443458541311479572950570629458267471872*S^2-1408120642774137245176526948273804541952*S-201040921881819649518191926112971291323)
-2181008857042518016*(11771381206853467500*S^2-234096198796658868577*S+399419996882697856)/(16225927682921336339157801028812800000000*S^4+166 14807230780501961378636831601459200000*S^3-123443458541311479572950570629458267471872*S^2-1408120642774137245176526948273804541952*S-201040921881819649518191926112971291323)+208855047 1830367232*(439804651110400000000*S^3+215064474392 985600000*S^2+810894223531311104*S-36748286147627266875)/(16225927682921336339157801028812800000000*S^4+166 14807230780501961378636831601459200000*S^3-123443458541311479572950570629458267471872*S^2-1408120642774137245176526948273804541952*S-201040921881819649518191926112971291323)+57062*(32 45185536584267267831560205762560000*S^2+6926573581 312154505379064187977728*S-13330634420839389668941552689815021)/(16225927682921336339157801028812800000000*S^4+166 14807230780501961378636831601459200000*S^3-123443458541311479572950570629458267471872*S^2-1408120642774137245176526948273804541952*S-201040921881819649518191926112971291323)
-1090504428521259008*(71282502283170598029+47961534 5916448342016*S)/(16225927682921336339157801028812800000000*S^4+166 14807230780501961378636831601459200000*S^3-123443458541311479572950570629458267471872*S^2-1408120642774137245176526948273804541952*S-201040921881819649518191926112971291323)-18371084231796319275233371488256*(393530000*S+8507 31)/(16225927682921336339157801028812800000000*S^4+166 14807230780501961378636831601459200000*S^3-123443458541311479572950570629458267471872*S^2-1408120642774137245176526948273804541952*S-201040921881819649518191926112971291323)-501922660033232896*(368934881474191032320000*S^2+1 98769774193057618722816*S+516495896073503509923)/(16225927682921336339157801028812800000000*S^4+166 14807230780501961378636831601459200000*S^3-123443458541311479572950570629458267471872*S^2-1408120642774137245176526948273804541952*S-201040921881819649518191926112971291323)
Why have you declared S to be symbolic?

CB

3. These are Laplace Inverses of a previously defined matrix, hence the S symbolic. It is the Lapalace Variable. I was given the orignial matrix in Laplace Transformed format.

4. Originally Posted by buckeye
These are Laplace Inverses of a previously defined matrix, hence the S symbolic. It is the Lapalace Variable. I was given the orignial matrix in Laplace Transformed format.
But that is what forces all the numerical calculations to be arbitrary precision and so is why the output is unreadable. There is some way of converting the numerical values back to floating point precision (but I don't know what it is as I don't have the symbolic toolboxes).

CB