連立方程式の解について、変数文字の係数を分数でなく小数で表示したい
17 views (last 30 days)
Show older comments
連立方程式を解く際に、解に含まれる文字の係数を実数で表示するようにしたいです。
以下は例です。
format compact
syms x1 y1 z1 z2
eqn1 = 1/10*x1+10/90*y1+z1 == 10
eqn2 = (2*x1+y1-4/9)/(20+5/2*z1) == -1
eqn3 = (2*x1+y1-5/6*z2)/20-(z1+x1*2) == 9.6
sol = solve([eqn1, eqn2,eqn3], [x1,y1,z1]);
x1Sol = sol.x1
y1Sol = sol.y1
z1Sol = sol.z1
計算結果は以下のようコマンドウィンドウに表示されます。
x1Sol =
- (65*z2)/3417 - 8132/603
y1Sol =
(105*z2)/2278 - 1944/67
z1Sol =
43936/3015 - (11*z2)/3417
この結果を以下のように表示する方法はありますか?
x1Sol =
- 0.0190*z2 - 13.4859
y1Sol =
0.0461*z2 - 29.0149
z1Sol =
14.5725 - 0.0032*z2
0 Comments
Accepted Answer
More Answers (0)
See Also
Categories
Find more on 数値と精度 in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!