Filter löschen
Filter löschen

Why the result of my code is empty matrices?

1 Ansicht (letzte 30 Tage)
Faezeh Manesh
Faezeh Manesh am 6 Apr. 2021
Beantwortet: Vishesh am 20 Sep. 2023
Hi,
I am trying to solve a system of nonlinear equations using the folowing code. When I run my code it gives me empty matrices. Can someone help me why this happens and how I can fix this problem?
clc
clear all
syms a1 a2 a3 b1 b2 b3 c1 c2 c3
a3=0;
b3=0;
m1=0.894;
m2=0.894;
m3=1.252;
eq1 = a1*a2+b1*b2+c1*c2==0;
eq2 = a2*a3+b2*b3+c2*c3==0;
eq3 = a1*a3+b1*b3+c1*c3==0;
eq4 = (a1)^2+(b1)^2+(c1)^2==1;
eq5 = (a2)^2+(b2)^2+(c2)^2==1;
eq6 = (a3)^2+(b3)^2+(c3)^2==1;
M1=[a1*a1 a1*b1 a1*c1;a1*b1 b1*b1 b1*c1;a1*c1 b1*c1 c1*c1];
M2=[a2*a2 a2*b2 a2*c2;a2*b2 b2*b2 b2*c2;a2*c2 b2*c2 c2*c2];
M3=[a3*a3 a3*b3 a3*c3;a3*b3 b3*b3 b3*c3;a3*c3 b3*c3 c3*c3];
M = m1*M1+m2*M2+m3*M3;
eq7 = det(M)==1;
eqns = [eq1 eq2 eq3 eq4 eq5 eq6 eq7];
vars = [a1 a2 b1 b2 c1 c2 c3];
[S_a1, S_a2, S_b1, S_b2, S_c1, S_c2, S_c3] = solve(eqns,vars);
Thanks,
Faezeh

Antworten (1)

Vishesh
Vishesh am 20 Sep. 2023
I understand that you are getting empty matrices on executing your code.
I would like to inform you that "solve()" function returns empty matrices when no solutions exist for the given equations.
To resolve this issue , please double-check your equations and run your code again.
For more information on "solve()" function, please refer to the following documentation:

Kategorien

Mehr zu Programming finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by