MATLAB outputs fractions instead of float values

36 visualizzazioni (ultimi 30 giorni)
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 =

Risposta accettata

Walter Roberson
Walter Roberson il 27 Set 2019
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))

Più risposte (0)

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by