selecting the positive result
10 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi everyone! I have a question on fsolve:i did a code for solving with fsolve 2eqs in 2 variables,but one of the variable is squared. What happens is that fsolve gives me the negative root of that variable,instead of the positive one. How can i achieve that? Maybe with some options? thanks.
2 Kommentare
Image Analyst
am 23 Dez. 2016
So you're basically finding where a line intersects a parabola? Why doesn't it give all solutions? There should be two solutions unless your intersection point is perpendicular or tangent to the vertex of the parabola. Let's see your code - you forgot to include it.
Antworten (1)
Aylin
am 27 Dez. 2016
Bearbeitet: Aylin
am 27 Dez. 2016
Hello Domenico,
If you are trying to solve a polynomial equation, then you may want to use the roots function instead. However, if the fsolve function works best for you, please refer to the following MATLAB documentation page for some techniques on solving nonlinear systems with constraints:
In particular, if you would like to get only positive zeros from your code, you can run fsolve for a range of starting values, and then use only the starting values that give you positive results.
Rylan
1 Kommentar
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!