Empty sym: 0-by-1 in solving a system of equations

26 views (last 30 days)
Hi friends
I am trying to solve the following symbolic system of equations:
While are parameters. And I want to find in terms of .
I used the code as below but I faced an error as :
ans =
Empty sym: 0-by-1
My code is:
syms N1 N2 N3 M1 M2 M3 D21 D32 S1 S2 S3
eqn=[M1==1,N1*cos(0)==0, M1*sin(S1)+N1*cos(S1)==N2*cos(0), M2*sin(S2)+N2*cos(S2)==N3*cos(0), M3*sin(S3)+N3*cos(S3)==0, M1*cos(S1)-N1*sin(S1)==M2*D21*cos(0), M2*cos(S2)-N2*sin(S2)==M3*D32*cos(0)];
A=solve(eqn,[M1 M2 M3 N1 N2 N3]);
A.M1
A.M2
A.M3
A.N1
A.N2
A.N3
Could you please guide me how can I solve the problem?
Thanks in advance.

Accepted Answer

Walter Roberson
Walter Roberson on 1 Nov 2021
You have 7 equations that you want to solve for 6 unknown. That is not generally possible.
solve the first 6 equations for the 6 unknown and subs() the results into the last eqn. The result will effectively be a constraint between the 5 variables.
You can solve() the constraint for any 1 variable. Solving for either D variable gives a comparatively uncomplicated result. Solving for S1 or S2 give single results that are complicated involving log and complex numbers. Solving for S3 gives two families of complicated solutions similar to the other S ones but also having 2*pi*k as a factor for integer k (so a periodic solution)
But if the D and S are inputs then the overall system has no solution unless the 7th equation happens to hold.
  3 Comments
Mahsa Babaee
Mahsa Babaee on 10 Nov 2021
Thank you so much. Your explanations are really helpful.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!