Need help with a system non-linear equation with three variables
1 view (last 30 days)
Show older comments
I have a set of data:
x (array) containing as many data points as we want (known to user)
y (array) containing as many data points as x (also known)
and corresponding set of X (array) and Y (array) (both known).
Now using these arrays, we can frame the following expressions:
Rx(i)=((d*cos(theta)*cos(phi)+X(i)*sin(phi))*(x(i)*cos(psi)-y(i)*sin(psi))-d*sin(theta)*(x(i)*sin(psi)+y(i)*cos(psi)))/(X(i)*cos(phi2)-d*sin(phi2)*cos(theta2))
Ry(i)=((d*sin(theta)*cos(phi)+Y(i)*sin(phi))*(x(i)*cos(psi)-y(i)*sin(psi))+d*cos(theta)*(x(i)*sin(psi)+y(i)*cos(psi)))/(Y(i)*cos(phi2)-d*sin(phi2)*sin(theta2))
(we can get as many set of expressions for Rx and Ry as many data points we've considered for x, y, X, Y)
Note that the other variables (d, phi2, theta2) are also known.
Using this expressions, i want to find the value of theta, phi and psi for which:
F(i)=Rx(i)-Ry(i)=0
theta can take values from [0,360], psi from [0,360], and phi from [0,90] (in degrees)
There can be multiple solutions.
0 Comments
Answers (1)
John D'Errico
on 3 Mar 2024
Simple. Use lsqnonlin.
There will almsot certainly be no exact solution. All you can do is find a parameter set that minimizes the sum of squares of the difference, i.e., lsqnonlin.
Yes, there will ALWAYS be multiple colutions, since this is a trig problem, and therefore infinitely many equivalent solutions.
0 Comments
See Also
Categories
Find more on Systems of Nonlinear Equations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!