필터 지우기
필터 지우기

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

조회 수: 2 (최근 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
Walter Roberson
Walter Roberson 2021년 6월 6일
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 2021년 6월 6일
Ok
Thanks Walter
I will try then it manually

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Conversion Between Symbolic and Numeric에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by