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

조회 수: 1(최근 30일)
MINATI PATRA
MINATI PATRA 2021년 6월 5일
댓글: MINATI PATRA 2021년 6월 6일
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!

채택된 답변

Walter Roberson
Walter Roberson 2021년 6월 5일
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
MINATI PATRA
MINATI PATRA 2021년 6월 6일
Ok
Thanks Walter
I will try then it manually

댓글을 달려면 로그인하십시오.

추가 답변(0개)

Community Treasure Hunt

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

Start Hunting!

Translated by