How to get the equation inside that of root(function,z) equation ,i.e the function only

조회 수: 2 (최근 30일)
root(z^4 - (190266216202962831605969987684001433013625*z^3)/142934430860719287430314339936263093557948 + (1101852793399817336417575000084289382730783*z^2)/2286950893771508598885029438980209496927168 - (23080530109547214937644974638002755076096*z)/893340192879495546439464624601644334737175 + 8413353246836900979045156398614448177152/22333504821987388660986615615041108368429375, z)
I'm getting this as a solution , how can i get that equation alone ,i want to extract that equation and use fzero to solve for the root in the interval i want?

채택된 답변

Star Strider
Star Strider 2021년 12월 2일
The vpa funciton usually works —
syms z
Zfcn = root(z^4 - (190266216202962831605969987684001433013625*z^3)/142934430860719287430314339936263093557948 + (1101852793399817336417575000084289382730783*z^2)/2286950893771508598885029438980209496927168 - (23080530109547214937644974638002755076096*z)/893340192879495546439464624601644334737175 + 8413353246836900979045156398614448177152/22333504821987388660986615615041108368429375, z)
Zfcn = 
Zvpa = vpa(Zfcn)
Zvpa = 
.

추가 답변 (1개)

Jon
Jon 2021년 12월 2일
This is a polynomial, you should be able to obtain all of the roots (real and complex) using:
r = roots([1.0 ...
-(190266216202962831605969987684001433013625)/142934430860719287430314339936263093557948 ...
(1101852793399817336417575000084289382730783)/2286950893771508598885029438980209496927168 ...
-(23080530109547214937644974638002755076096)/893340192879495546439464624601644334737175 ...
8413353246836900979045156398614448177152/22333504821987388660986615615041108368429375])
  댓글 수: 2
Jon
Jon 2021년 12월 2일
In this case this gives
r =
0.6371
0.6330
0.0306
0.0306
Be careful on the line extension "..." you must leave a space after the number otherwise it will think the first dot is a decimal point and get confused
Jon
Jon 2021년 12월 2일
I see another answer was already posted by the time I answered. Note I don't have the symbolic toolbox shown in @Star Strider's, answer. I'm not sure if you do. In anycase you can do it this way with the core MATLAB functionality

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

카테고리

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