Incorrect output of a symbolic formula
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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
F_col1 = symmatrix(F_rad([1 2]).');
F_col2 = symmatrix(F_rad([3 4]).');
whos F_col1
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)
whos S_calc
%%%% Result %%%
simplify(symmatrix2sym(S_calc))
Error:
0 commentaires
Réponses (0)
Voir également
Catégories
En savoir plus sur Calculus dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!