# Symplify symbolic expression instead of outputting very large denominator values

8 Ansichten (letzte 30 Tage)
monkey_matlab am 3 Jun. 2017
Kommentiert: Walter Roberson am 3 Jun. 2017
Hello,
In this code:
z = 1;
Q = z^2 -1.368*z + 0.368 + 0.368*k*z + 0.264*k
Q =
(79*k)/125 - 1/9007199254740992
Is it possible to leave the final equation like this form:
Q = 0.632*k
Thanks.
##### 0 Kommentare-2 ältere Kommentare anzeigen-2 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

### Antworten (1)

Star Strider am 3 Jun. 2017
Use the vpa function:
Q = vpa(Q,4)
Q =
0.632*k
##### 3 Kommentare1 älteren Kommentar anzeigen1 älteren Kommentar ausblenden
Star Strider am 3 Jun. 2017
The imaginary part is essentially 0.
The only option that works is to use the children function:
syms k
Q = (79*k)/125 - 1/9007199254740992;
Q = children(Q);
Q = vpa(Q(1),4)
Q =
0.632*k
Walter Roberson am 3 Jun. 2017
That is not imaginary part, that is due to round-off and representation issues.
Take each of your numbers and wrap them with sym() with 'd' option. Like instead 0.368 code sym(0.368,'d')

Melden Sie sich an, um zu kommentieren.

### Kategorien

Mehr zu Conversion Between Symbolic and Numeric finden Sie in Help Center und File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by