Effacer les filtres
Effacer les filtres

vpa(Fv,5) can not consider all the terms

2 vues (au cours des 30 derniers jours)
MINATI PATRA
MINATI PATRA le 5 Juin 2021
Commenté : MINATI PATRA le 6 Juin 2021
Fv = - 4.4574e-25*x^21 + 3.0044e-21*x^20 - 5.6303e-17*x^19 + 1.7379e-13*x^18 - 1.4891e-9*x^17 + 1.3636e-8*x^16 - 2.8806e-9*x^15 - 2.0262e-7*x^14 - 7.3855e-8*x^13 - 4.8971e-7*x^12 + 0.000011088*x^11 + 0.000021129*x^10 - 0.000080694*x^9 + 0.00010399*x^8 - 0.0011636*x^7 - 0.010797*x^6 - 0.00084088*x^5 - 0.2542*x^4 + 0.1897*x^3 - 2.0757*x^2 + 0.78487*x + 0.078487;
%% And Can it be arranged in ascending order (Please help!)
%% vpa(Fv,5) can not consider all the terms
Have a try!

Réponse acceptée

Walter Roberson
Walter Roberson le 5 Juin 2021
It is not clear what you mean about considering all of the terms. vpa(Fv,5) looked fine to me. I did notice, though, that vpa() rounds to that number of significant digits, and perhaps what you want is to round in absolute digits.
sympref('PolynomialDisplayStyle', 'ascend')
ans = 'default'
syms x
Fv = - 4.4574e-25*x^21 + 3.0044e-21*x^20 - 5.6303e-17*x^19 + 1.7379e-13*x^18 - 1.4891e-9*x^17 + 1.3636e-8*x^16 - 2.8806e-9*x^15 - 2.0262e-7*x^14 - 7.3855e-8*x^13 - 4.8971e-7*x^12 + 0.000011088*x^11 + 0.000021129*x^10 - 0.000080694*x^9 + 0.00010399*x^8 - 0.0011636*x^7 - 0.010797*x^6 - 0.00084088*x^5 - 0.2542*x^4 + 0.1897*x^3 - 2.0757*x^2 + 0.78487*x + 0.078487
Fv = 
mapSymType(Fv, 'rational', @(e)round(e,5))
ans = 
Is that what you were talking about?
Notice that a lot of the high-order terms are now missing, because their coefficient rounded to 5 decimal places was 0.
  5 commentaires
Walter Roberson
Walter Roberson le 6 Juin 2021
None of the built-in MATLAB display formats will do that for you.
If you were preparing a character vector with the results, then you would have more options.
Do you need the result to be character? Do you need the result to be symbolic? Do you need to write this out to a file? Is this to be displayed in a GUI?
MINATI PATRA
MINATI PATRA le 6 Juin 2021
Ok
Thanks Walter
I will try then it manually

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by