Alternatives to fsolve for solving systems of nonlinear equations with boundaries

조회 수: 11 (최근 30일)
I’m solving an inverse kinematic problem for a four joint robotic arm. Essentially I have 3 equations (X, Y, Z) and four unknowns (Joint 1 – Joint4) so there are multiple possible solutions for each joint angle. It is a system of nonlinear equations.
fsolve is doing a wonderful job of solving the system for me, but in order to be able to apply my program to actual robot control I need to be able to add constraints to the possible range of the joint angles. They must be between 0 and pi radians.
I’ve tried lsqnonlin with boundaries but run into the problem that I have 3 equations and 4 unknowns.
Are there alternative functions that allow boundary inputs that will solve systems of nonlinear equations? Alternativly, is there a way to use/modify fsolve to force solutions into a range? I'm on R2012b.
Any thoughts would be much appreciated as I'm out of ideas and my google-fu is failing me.
  댓글 수: 2
Matt J
Matt J 2013년 3월 23일
I’ve tried lsqnonlin with boundaries but run into the problem that I have 3 equations and 4 unknowns.
How is that a problem? If you didn't care which of many solutions FSOLVE gave you, why do you care with LSQNONLIN?
Orion
Orion 2013년 3월 23일
Sorry, what I meant was that the algorithm that LSQNONLIN uses to solve systems with boundary conditions won’t accept more unknowns than equations. Without the conditions, LSQNONLIN gives the same results as FSOLVE, which are often negative angles or > pi.

댓글을 달려면 로그인하십시오.

채택된 답변

Orion
Orion 2013년 3월 25일
I ended up doing a little trig to find a fourth equation, giving me 4 equations and 4 unknowns. Now I can use LSQNONLIN to put upper and lower bounds on my problem and solve it. Works great!

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Robotics에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by