MATLAB outputs fractions instead of float values
36 ビュー (過去 30 日間)
古いコメントを表示
Good day,
So I am trying to calculate the values from a few linear equations. The code works (I think it does but can't justify my answers yet because of this) but the output is in huge fractions. I would like to submit a pdf document but i want the outputs to be readable. Please help. Example code below:
syms x y z; %x = Ie, y = Ib, z = Vce
eqn1 = -x + y.*(BF+1) + z*(0) == 0;
eqn2 = x*(Re) + y*(REQ) + z*(0) == VEQ + VBE;
eqn3 = x*(Re) + y*(Rc*BF) + z*(1) == Vcc;
[A,B] = equationsToMatrix([eqn1, eqn2, eqn3], [x, y, z]);
X = linsolve(A, B);
format
X1 = X(1)
All the variables have been declared/calculated before this point. Example output:
X1 =
0 件のコメント
採用された回答
Walter Roberson
2019 年 9 月 27 日
This is correct. The Symbolic Toolbox is intended for situations where you want indefinitely precise closed-form answers, or at least indefinitely precise answers.
You can double() the answers. Or you can linsolve(double(A), double(B))
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Numbers and Precision についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!