How can I pick only first solution of equation

31 ビュー (過去 30 日間)
Dominika Krason
Dominika Krason 2021 年 8 月 5 日
回答済み: Walter Roberson 2021 年 8 月 5 日
I made measurements and used them to plot x against y and found function that would describe the plot.
p1 = 258787.8788
p2 = -650125.2525
p3 = 577986.6667
p4 = -227435.083
p5 = 35645.6381
syms x
y = p1*x^4 + p2*x^3 + p3*x^2 + p4*x + p5 == pow
S = vpasolve (y,x)
I use variable 'pow' but lets say right now pow = 1430.
As a soultion I get 4 different values (as expected) but I only need the first one further on in the project. Its always the first one and values are too close to each other to put any assumptions which I tried.
Is there any way to make matlab ignore the three other solutions or anything that would give me similar results?
Thanks in advance for all the help :)

採用された回答

Walter Roberson
Walter Roberson 2021 年 8 月 5 日
S(1)

You should also be considering

 roots([p1, p2, p3, p4, p5]) 

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeProgramming についてさらに検索

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by