Nonlinear system of equations with constrains
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Mohammad Monfared
el 6 de Oct. de 2013
Comentada: Matt J
el 6 de Oct. de 2013
Hi every body,
I have 4 nonlinear equations and 4 unknowns to be solved. but my unknowns are constrained. So I can't use something like fsolve. Which function do I need to use? I also have optimization toolbox. Is 'fgoalattain' my answer?(I've tried it but not familiar how it works:( )
thanx
0 comentarios
Respuesta aceptada
Matt J
el 6 de Oct. de 2013
Editada: Matt J
el 6 de Oct. de 2013
If the constraints are simple upper and lower bounds, you can use lsqnonlin(). Otherwise, you could use fmincon().
2 comentarios
Matt J
el 6 de Oct. de 2013
Editada: Matt J
el 6 de Oct. de 2013
The problem with 'lsqnonlin' is that it doesn't minimize(solve) each equation separately but minimizes (f1(x)+f2(x)+...).
No, that isn't to be viewed as a problem. If the system of equations possesses a simultaneous solution then that solution must globally minimize the sum of squares (f1(x)+f2(x)+...), bringing it to a minimum value of zero. Similar remarks apply to fmincon.
If you're not getting the results you want it is likely because of one or more of the following,
- You have coded your objective function incorrectly
- You have given a bad initial guess x0
- Your system does not have a simultaneous solution. You must relax your requirements and accept a least squares solution in that case.
Más respuestas (0)
Ver también
Categorías
Más información sobre Get Started with Optimization Toolbox en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!