Clear Filters
Clear Filters

How to set the interval of the solution when I use "vpasolve" to solve an equation?

7 views (last 30 days)
I want to solve an equation using "vpasolve" in MATLAB R2018a, equations may have more than one solutions, for example, 'x^2-1==0' has two solutions: -1 and 1, but if I limit the interval of the solutions to be [0,2], then only one solution left.
So how can I limit the interval to filter the solutions when I use "vpasolve" to solve an equation? Anyone can show me the simplest way? Thank you!

Accepted Answer

Walter Roberson
Walter Roberson on 31 Oct 2023
vpasolve() and pass a list of equations as the first parameter.
Pass a list of variables in the second parameter.
In the third parameter pass as many rows as there are variables. If you pass a column vector then each row is the starting value for the corresponding variable from the second parameter. If you pass an array with two columns then the first column is the lower bound and the second column is the upper bound. You can pass -inf as a lower bound or +inf as an upper bound.
Be careful that what you pass is row oriented. If you are were to try to pass a row with one value per variable (initial value) then that would fail.

More Answers (0)

Products


Release

R2018a

Community Treasure Hunt

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

Start Hunting!