I am unable to solve my system of equations using MATLAB, Can anyone go through the code and suggest me some?

11 visualizaciones (últimos 30 días)
Hello all,
I am trying to solve a system of equations (one quadratic, two linear equations) using MATLAB 'solve' command. But everytime it is not showing the result. Will you please go through the code and suggest me some.
% Here is my code
syms x y z
eqn1 = (x-x1)*(x-x2)+ (y-y1)*(y-y2)+(z-z1)*(z-z2)== d1*d2*cosd(intersxn_angle);
eqn2 = (x1-x2)*(x1-x)+(y1-y2)*(y1-y)+(z1-z2)*(z1-z)== d1*d*cosd(theta2);
eqn3 =(x2-x1)*(x2-x)+ (y2-y1)*(y2-y)+(z2-z1)*(z2-z) == d*d2*cosd(theta1);
eqns = [eqn1, eqn2 eqn3];
Vars =[x y z];
[solx, soly, solz] = solve(eqns,vars);
In the above code x1, y1, z1, x2, y2, z2, d1, d2, d, intersxn_angle, theta1, and, theta2 are known to me. The only unkowns are x, y, z . When i am running the above code, every time i am getting x, y, z as ox1 symbol, which means empty result. In the above code, whether my equations are inconsistent or i need to use any other command or another way to equations. Please suggest me some. I am stuck with this code.
Thank you.

Respuesta aceptada

Walter Roberson
Walter Roberson el 19 de Abr. de 2021
syms x1 x2 y1 y2 z1 z2
syms d d1 d2 intersxn_angle theta1 theta2
syms x y z
eqn1 = (x-x1)*(x-x2)+ (y-y1)*(y-y2)+(z-z1)*(z-z2)== d1*d2*cosd(intersxn_angle);
eqn2 = (x1-x2)*(x1-x)+(y1-y2)*(y1-y)+(z1-z2)*(z1-z)== d1*d*cosd(theta2);
eqn3 =(x2-x1)*(x2-x)+ (y2-y1)*(y2-y)+(z2-z1)*(z2-z) == d*d2*cosd(theta1);
zsol = solve(eqn3,z)
zsol = 
eqn2_b = simplify(subs(eqn2, z, zsol))
eqn2_b = 
Look at that eqn2_b and notice that it has no x and no y. Your equations do not have full rank.
  1 comentario
CHANDRA SEKHAR UTLA
CHANDRA SEKHAR UTLA el 19 de Abr. de 2021
Editada: CHANDRA SEKHAR UTLA el 19 de Abr. de 2021
Thank you walter Roberson for giving your time, and suggestion. So eqn 2 and eqn 3 are represnting same. So, I need to provide another equation for finding x, y and z.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Applications en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by