question about result in matlab

3 ビュー (過去 30 日間)
oun alsharif
oun alsharif 2021 年 11 月 16 日
コメント済み: oun alsharif 2021 年 11 月 16 日
% SOLVE EXAM
% A=U23 , B=U33 , C=U43 , D=U22 , E=U32 , F=U42
syms A B C D E F
eqn1= A - 0.25*E == 6.25;
eqn2=B-0.25*F-0.25*D == 4.45;
eqn3=C-0.25*E == 6.8;
eqn4=D-0.25*B==5.5;
eqn5=E-0.25*C-0.25*A==3.87;
eqn6=F-0.25*B==6.45;
[X,Y]=equationsToMatrix([eqn1,eqn2,eqn3,eqn4,eqn5,eqn6]);
n=linsolve(X,Y);
display(n)
why result appear :
11603/1400
17/2
12373/1400
61/8
2853/350
343/40

採用された回答

Sudharsana Iyengar
Sudharsana Iyengar 2021 年 11 月 16 日
Try this
syms A B C D E F
eqn1= A - 0.25*E == 6.25;
eqn2=B-0.25*F-0.25*D == 4.45;
eqn3=C-0.25*E == 6.8;
eqn4=D-0.25*B==5.5;
eqn5=E-0.25*C-0.25*A==3.87;
eqn6=F-0.25*B==6.45;
[X,Y]=equationsToMatrix([eqn1,eqn2,eqn3,eqn4,eqn5,eqn6]);
%n=linsolve(X,Y);
n = double(linsolve(X,Y)); %makes everything in float format
display(n)
n = 6×1
8.2879 8.5000 8.8379 7.6250 8.1514 8.5750
n = vpa(linsolve(X,Y));
display(n)
n = 
  1 件のコメント
oun alsharif
oun alsharif 2021 年 11 月 16 日
MANY YHANKS

サインインしてコメントする。

その他の回答 (1 件)

KSSV
KSSV 2021 年 11 月 16 日
編集済み: KSSV 2021 年 11 月 16 日
Becuase n is a class of sym. Use double.
double(n)
Also note that you need not use syms to achieve this. Frame your matrices and use \.
n = double(X)\double(Y)
  1 件のコメント
oun alsharif
oun alsharif 2021 年 11 月 16 日
MANY THANKS

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeLinear Algebra についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by