Asked by Nindya Putri
on 12 Apr 2011

Hello. I am trying to solve the equations:

xl+d*vx-k*xlp=0

yl+d*vy-k*ylp=0

zl+d*(sqrt(1-vx^2-vy^2))+k*c=0

where xl,yl,zl,vx,vy,and k are unknowns. xlp, ylp, and c are known. I need help to choose which function that I should use and how?

I already try the 'fsolve' function and there was a warning "Optimizer appears to be converging to a point which is not a root. Norm of relative change in X is less than max(options.TolX^2,eps) but sum-of-squares of function values is greater than or equal to sqrt(options.TolFun) Try again with a new starting guess."

am I in a right way or not?

I really need help about this.

Answer by Andrew Newell
on 12 Apr 2011

Your problem is ill-determined. You have three equations for six unknowns (and possibly a seventh, d). You need to either add some equations or reduce the number of unknowns.

Log in to comment.

Answer by Nindya Putri
on 12 Apr 2011

oh yes, d is known. And k is a factor for one system (3 equations) I have about 18 equations as below : x(1)+3036*x(2)-0.498912*x(3);

x(4)+3036*x(5)-(-1.564297)*x(3);

x(6)+3036*sqrt(1-(x(2)^2)-(x(5)^2))+28.46006*x(3);

x(1)+4592*x(2)-1.044597*x(7);

x(4)+4592*x(5)-(-1.517524)*x(7);

x(6)+4592*sqrt(1-(x(2)^2)-(x(5)^2))+28.46006*x(7);

x(1)+5968*x(2)-1.283659*x(8);

x(4)+5968*x(5)-(-1.496736)*x(8);

x(6)+5968*sqrt(1-(x(2)^2)-(x(5)^2))+28.46006*x(8);

x(1)+3226*x(2)-0.592458*x(9);

x(4)+3226*x(5)-(-1.5591)*x(9);

x(6)+3226*sqrt(1-(x(2)^2)-(x(5)^2))+28.46006*x(9);

x(1)+4485*x(2)-1.013415*x(10);

x(4)+4485*x(5)-(-1.517524)*x(10);

x(6)+4485*sqrt(1-(x(2)^2)-(x(5)^2))+28.46006*x(10);

x(1)+6012*x(2)-1.288856*x(11);

x(4)+6012*x(5)-(-1.496736)*x(11);

x(6)+6012*sqrt(1-(x(2)^2)-(x(5)^2))+28.46006*x(11);

where x(1)=xl, x(2)=vx, x(3,7,8,...)=(k1,2,3,..), x(4)=yl, x(5)=vy, x(6)=zl. I have tried using the function for several times but the warning still exist. Is this a correct way?

Log in to comment.

Answer by Andrew Newell
on 12 Apr 2011

Now you have 18 equations for 11 unknowns, so the system is overdetermined. Unless some of these equations are redundant, you will have no solutions.

It appears that you are trying to solve for a set of unit vectors. Maybe they aren't unit vectors? You could try replacing each square root by an independent variable. That would give you 17 unknowns.

It would make sense to have 9 three-dimensional vectors, for a total of 18 variables.

Nindya Putri
on 13 Apr 2011

yes ofcourse, because it is not square, the function used Gauss-newton method. My next question, from the function that i've made, does the result give the correct value? how can I evaluate the result?

Steve Grikschat
on 18 Apr 2011

You can validate that the result is correct by checking the residual (fsolve has done this for you and it appears to not be close to zero).

However, since this isn't a square system, you are solving an overdetermined least-squares problem which means that the solution only minimizes the sum of squares. In this case, you might check optimization-related quantities like the first-order-optimality measure. This tells you how close to a minimizer you got.

Again, fsolve has done this and it seems that it is not close enough (compared to options.TolFun). However, if it is small enough, you might be satisfied.

There are multiple solutions to your (least-squares) problem. You might have gotten close to one.

Nindya Putri
on 22 Apr 2011

thank you very much for you help. It really helps.

Log in to comment.

Related Content

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn moreOpportunities for recent engineering grads.

Apply Today
## 2 Comments

## Andrew Newell (view profile)

Direct link to this comment:https://www.mathworks.com/matlabcentral/answers/5333-solving-a-nonlinear-equation-problem#comment_10973

Is d known?

## Nindya Putri (view profile)

Direct link to this comment:https://www.mathworks.com/matlabcentral/answers/5333-solving-a-nonlinear-equation-problem#comment_10976

oh yes, d is known. And k is a factor for one system (3 equations)

I have about 18 equations as below :

x(1)+3036*x(2)-0.498912*x(3);

x(4)+3036*x(5)-(-1.564297)*x(3);

x(6)+3036*sqrt(1-(x(2)^2)-(x(5)^2))+28.46006*x(3);

x(1)+4592*x(2)-1.044597*x(7);

x(4)+4592*x(5)-(-1.517524)*x(7);

x(6)+4592*sqrt(1-(x(2)^2)-(x(5)^2))+28.46006*x(7);

x(1)+5968*x(2)-1.283659*x(8);

x(4)+5968*x(5)-(-1.496736)*x(8);

x(6)+5968*sqrt(1-(x(2)^2)-(x(5)^2))+28.46006*x(8);

x(1)+3226*x(2)-0.592458*x(9);

x(4)+3226*x(5)-(-1.5591)*x(9);

x(6)+3226*sqrt(1-(x(2)^2)-(x(5)^2))+28.46006*x(9);

x(1)+4485*x(2)-1.013415*x(10);

x(4)+4485*x(5)-(-1.517524)*x(10);

x(6)+4485*sqrt(1-(x(2)^2)-(x(5)^2))+28.46006*x(10);

x(1)+6012*x(2)-1.288856*x(11);

x(4)+6012*x(5)-(-1.496736)*x(11);

x(6)+6012*sqrt(1-(x(2)^2)-(x(5)^2))+28.46006*x(11);

where x(1)=xl, x(2)=vx, x(3,7,8,...)=(k1,2,3,..), x(4)=yl, x(5)=vx, x(6)=zl.

I have tried using the function for several times but the warning still exist.

Is this a correct way?

Log in to comment.