solution of 3d nonlinear equation
12 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
ali hassan
le 29 Sep 2020
Modifié(e) : Walter Roberson
le 30 Sep 2020
x_p, y_p, z_p=(4, 5, 2)
x_1, y_1, z_1=(8, 9, 5)
x_2, y_2, z_2=(2, 5, 1)
x_3, y_3, z_3=(6, 1, 3)
t_1=5.692820*10^-9
t_2=-2.924173*10^-9
t_3=-12.010097*10^-9
c=3.0*10^8
and my three equations are
eqn1 = sqrt((x(s)-x_p)^2+(y(s)-y_p)^2+(z(s)-z_p)^2)-sqrt((x(s)-x_1)^2+(y(s)-y_1)^2+(z(s)-z_2)^2)-(c*t_1)
eqn2 = sqrt((x(s)-x_p)^2+(y(s)-y_p)^2+(z(s)-z_p)^2)-sqrt((x(s)-x_2)^2+(y(s)-y_2)^2+(z(s)-z_2)^2)-(c*t_1)
eqn3 = sqrt((x(s)-x_p)^2+(y(s)-y_p)^2+(z(s)-z_p)^2)-sqrt((x(s)-x_3)^2+(y(s)-y_3)^2+(z(s)-z_3)^2)-(c*t_1)
where only x(s), y(s), z(s) are unknown are rest all are known
BEST REGARDS
1 commentaire
Walter Roberson
le 29 Sep 2020
Modifié(e) : Walter Roberson
le 29 Sep 2020
Perhaps the first equation should involve t1 instead of t_1, and second equation should involve t2 instead of t_1, and the third should involve t3 instead of t_1 ? You do not use t1, t2, or t3 after you define them.
Réponse acceptée
Walter Roberson
le 29 Sep 2020
x_p = 4; y_p = 5; z_p = 2;
x_1 = 8; y_1 = 9; z_1 = 5;
x_2 = 2; y_2 = 5; z_2 = 1;
x_3 = 6; y_3 = 1; z_3 = 3;
t1 = 5.692820*10^-9;
t2 = -2.924173*10^-9;
t3 = -12.010097*10^-9;
syms xs ys zs %our unknowns
syms c %constant not given in question
eqn1 = sqrt((xs-x_p)^2+(ys-y_p)^2+(zs-z_p)^2)-sqrt((xs-x_1)^2+(ys-y_1)^2+(zs-z_2)^2)-(c*t1);
eqn2 = sqrt((xs-x_p)^2+(ys-y_p)^2+(zs-z_p)^2)-sqrt((xs-x_2)^2+(ys-y_2)^2+(zs-z_2)^2)-(c*t2);
eqn3 = sqrt((xs-x_p)^2+(ys-y_p)^2+(zs-z_p)^2)-sqrt((xs-x_3)^2+(ys-y_3)^2+(zs-z_3)^2)-(c*t3);
sol = solve([eqn1, eqn2, eqn3], [xs, ys, zs]);
disp(sol.xs)
disp(sol.ys)
disp(sol.zs)
the values will be parameterized in c, which you indicate is a known value, but which you did not provide a value for.
There are two solutions for each variable.
You should probably re-substitute the solutions and verify that the values work, as MATLAB warns that some of the solutions produced might no be true solutions.
12 commentaires
Walter Roberson
le 30 Sep 2020
Modifié(e) : Walter Roberson
le 30 Sep 2020
That is not 6 possible solutions, that is two solutions with three components each.
possibleSol(:, all(possibleSol>0 & imag(possibleSol)==0, 1))
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Logical dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!