Incorrect output of a symbolic formula

2 visualizzazioni (ultimi 30 giorni)
reincornator
reincornator il 13 Ott 2021
Modificato: reincornator il 13 Ott 2021
Hello. I am performing calculations using symbolic calculations. The result satisfies me. However, the final formula is output with an error. The variables following the equation refer to each other. In the image, I marked one of the examples with arrows.
The formula is correct, and when substituting values, the calculation is also correct. Only its display is incorrect.
clear;
syms S [2 2] matrix
syms F_rad [2 2] matrix
syms V1 V2 [2 1] matrix
whos S
Name Size Bytes Class Attributes S 2x2 8 symmatrix
F_col1 = symmatrix(F_rad([1 2]).');
F_col2 = symmatrix(F_rad([3 4]).');
whos F_col1
Name Size Bytes Class Attributes F_col1 2x1 8 symmatrix
syms J [2 2] matrix
% 1
Erad1 =F_rad*V1;
Eref1 = S*J*Erad1;
Ecol1_d1 = F_col1.'*J*Eref1;
Ecol1_d2 = F_col2.'*J*Eref1;
% 2
Erad2 =F_rad*V2;
Eref2 = S*J*Erad2;
Ecol2_d1 = F_col1.'*J*Eref2;
Ecol2_d2 = F_col2.'*J*Eref2;
Eref1_HV = J\([F_col1 F_col2].'\[Ecol1_d1; Ecol1_d2]); % при J=J.'
Eref2_HV = J\([F_col1 F_col2].'\[Ecol2_d1; Ecol2_d2]); % при J=J.'
Eref_HV = [Eref1_HV Eref2_HV];
Erad_HV = [J*Erad1 J*Erad2];
% Final formula
S_calc = (Eref_HV/Erad_HV)
S_calc = 
whos S_calc
Name Size Bytes Class Attributes S_calc 2x2 8 symmatrix
%%%% Result %%%
simplify(symmatrix2sym(S_calc))
ans = 
Error:

Risposte (0)

Prodotti


Release

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by