How can I pick only first solution of equation

30 views (last 30 days)
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 :)

Accepted Answer

Walter Roberson
Walter Roberson on 5 Aug 2021
S(1)

You should also be considering

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

More Answers (0)

Categories

Find more on Programming in Help Center and File Exchange

Products


Release

R2020b

Community Treasure Hunt

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

Start Hunting!