MATLAB Answers

0

Mupad produces expressions with very small and neglectable factors, how can I remove them from the output.

Asked by Syed Qaseem Ali on 25 Nov 2015
Latest activity Edited by Walter Roberson
on 26 Nov 2015
Hi, I am trying to perform a decoupling operation on a certain 3x3 matrix. The answer I get after decoupling has a lot of terms in it and it seems that the matrix is not diagonalized, but after close inspection, most of the terms have very small factors rendering them negligible. Once neglected the matrix seems diagonalized.
Here is the operation I am trying to perform:
`θ_r`:=a:`α`:=b:`ω_r`:=0:
L_th1:=matrix([[L_0_1_1-L_d_1_1*cos(2*`θ_r`-2*`α`),-0.5*L_0_1_1-L_d_1_1*cos(2*`θ_r`-2*PI/3-2*`α`),-0.5*L_0_1_1-L_d_1_1*cos(2*`θ_r`+2*PI/3-2*`α`)],[-0.5*L_0_1_1-L_d_1_1*cos(2*`θ_r`-2*PI/3-2*`α`),L_0_1_1-L_d_1_1*cos(2*`θ_r`+2*PI/3-2*`α`),-0.5*L_0_1_1-L_d_1_1*cos(2*`θ_r`-2*`α`)],[-0.5*L_0_1_1-L_d_1_1*cos(2*`θ_r`+2*PI/3-2*`α`),-0.5*L_0_1_1-L_d_1_1*cos(2*`θ_r`-2*`α`),L_0_1_1-L_d_1_1*cos(2*`θ_r`-2*PI/3-2*`α`)]]):
T_ADr1:=sqrt(2/3)*matrix([[cos(`ω_r`*t+`θ_r`-`α`),cos(`ω_r`*t+`θ_r`-2*PI/3-`α`),cos(`ω_r`*t+`θ_r`+2*PI/3-`α`)],[-sin(`ω_r`*t+`θ_r`-`α`),-sin(`ω_r`*t+`θ_r`-2*PI/3-`α`),-sin(`ω_r`*t+`θ_r`+2*PI/3-`α`)],[1/sqrt(2),1/sqrt(2),1/sqrt(2)]]):
T_ADg1:=matrix([[cos(`ω_g`*t),sin(`ω_g`*t),0],[-sin(`ω_g`*t),cos(`ω_g`*t),0],[0,0,1]]):
T_1:=1:T_3:=1:T_2:=Simplify(T_1*((-cos(2*`ω_g`*t)+1)/sin(2*`ω_g`*t))^-1):T_4:=Simplify(T_3*((cos(2*`ω_g`*t)-1)/sin(2*`ω_g`*t))):
T_new1:=matrix([[T_1,T_2,0],[T_3,T_4,0],[0,0,1]]):
T_c_new1:=Simplify(T_new1*T_ADg1*T_ADr1):
Simplify(T_c_new1*L_th1*T_c_new1^-1);
And the output I get is this:
matrix([[1.5*L_0_1_1 + 1.5*L_d_1_1 + 2.602085214*10^(-18)*L_d_1_1*cos(4*a) + 2.602085214*10^(-18)*L_d_1_1*cos(4*b) + 1.734723476*10^(-18)*L_d_1_1*cos(2*a - 2*b) - 1.301042607*10^(-18)*L_d_1_1*cos(2*a - 4*b) - 2.168404345*10^(-18)*L_d_1_1*cos(2*a + 4*b) - 1.301042607*10^(-18)*L_d_1_1*cos(4*a - 2*b) - 2.168404345*10^(-18)*L_d_1_1*cos(4*a + 2*b) + 1.517883041*10^(-18)*L_d_1_1*cos(4*a - 4*b), 0, 0], [0, 1.5*L_0_1_1 - 1.5*L_d_1_1 - 8.67361738*10^(-19)*L_d_1_1*cos(4*a) - 8.67361738*10^(-19)*L_d_1_1*cos(4*b) + 4.33680869*10^(-19)*L_d_1_1*cos(2*a - 4*b) - 4.33680869*10^(-19)*L_d_1_1*cos(2*a + 4*b) + 4.33680869*10^(-19)*L_d_1_1*cos(4*a - 2*b) - 4.33680869*10^(-19)*L_d_1_1*cos(4*a + 2*b) - 1.734723476*10^(-18)*L_d_1_1*cos(4*a - 4*b), 0], [0, 0, 0]])
Is there a way to suppress the terms with factors raised to -19 and -18 from the output?

  0 Comments

Sign in to comment.

1 Answer

Answer by Walter Roberson
on 25 Nov 2015
Edited by Walter Roberson
on 26 Nov 2015

Switch from using 0.5 to using 1/2 . You are mixing symbolic and floating point arithmetic
Are your multiplications intended to be element-by-element or algebraic matrix multiplication?
Is your T_c_new1^-1 intended to indicate matrix inversion?

  1 Comment

I used the following command
Simplify(expression, Valuation=length)
This suppresses the floating numbers from the output. I will try using fractions too.

Sign in to comment.