Solving a system of multiple equations (including vector) for multiple variables

15 views (last 30 days)
JC Chia
JC Chia on 27 Oct 2020
Commented: Divija Aleti on 2 Nov 2020
I try to solve the equations to find the force acted on a suspension system of a car. Fn, Fcw and Fb are the forces acted upon the tyre. and F1-F5 is the force in the rods of the suspension system. In this calculation, i want to find the all the forces in the car's suspension system (in which the car is not moving). But my solution comes out to be 0x1 sym, how to I solve the problem? Thankss! (Sorry for the formatting, I no sure how to put it in better ways)
syms F1 F2 F3 F4 F5 FN Fcw Fb
A = table2array(PointCoordinates);
B = A';
B = B(:)';
Bc = mat2cell(B, 1, ones(1,27));
[X1, Y1, Z1, X2, Y2, Z2, X3, Y3, Z3, X4, Y4, Z4, X5, Y5, Z5, X6, Y6, Z6, X7, Y7, Z7, X8, Y8, Z8, X9, Y9, Z9] = Bc{:};
[G, b, L] = deal(300, 702, 1560);
eqn1 = F1 + F2 + F3 + F4 + F5 + FN + Fb + Fcw == 0;
eqn2 = F1*[X1-X6,Y1-Y6,Z1-Z6]/norm([X1-X6,Y1-Y6,Z1-Z6]) + F2*[X2-X6,Y2-Y6,Z2-Z6]/norm([X2-X6,Y2-Y6,Z2-Z6]) + F3*[X3-X7,Y3-Y7,Z3-Z7]/norm([X3-X7,Y3-Y7,Z3-Z7])+ F4*[X4-X7,Y4-Y7,Z4-Z7]/norm([X4-X7,Y4-Y7,Z4-Z7]) + F5*[X5-X8,Y5-Y8,Z5-Z8]/norm([X5-X8,Y5-Y8,Z5-Z8]) + FN*[0,0,1] + Fb*[1,0,0] +Fcw*[0,1,0] ==0;
eqn3 = -F1*(Y1-Y6)/norm([X1-X6,Y1-Y6,Z1-Z6])*Z1 - F1*(Z1-Z6)/norm([X1-X6,Y1-Y6,Z1-Z6])*(Y1-Y9) - F2*(Y2-Y6)/norm([X2-X6,Y2-Y6,Z2-Z6])*Z1 - F2*(Z2-Z6)/norm([X2-X6,Y2-Y6,Z2-Z6])*(Y2-Y9)-F3*(Y3-Y7)/norm([X3-X7,Y3-Y7,Z3-Z7])*Z3 - F3*(Z3-Z7)/norm([X3-X7,Y3-Y7,Z3-Z7])*(Y3-Y9) - F4* (Y4-Y7)/norm([X4-X7,Y4-Y7,Z4-Z7])*Z4 - F4*(Z4-Z7)/norm([X4-X7,Y4-Y7,Z4-Z7])*(Y4-Y9)- F5*(Y5-Y8)/norm([X5-X8,Y5-Y8,Z5-Z8])*Z5 + F5*(Z5-Z8)/norm([X5-X8,Y5-Y8,Z5-Z8])*(Y5-Y9) ==0;
eqn4 = -F1*(X1-X6)/norm([X1-X6,Y1-Y6,Z1-Z6])*Z1 - F1*(Z1-Z6)/norm([X1-X6,Y1-Y6,Z1-Z6])*(X1-X9) + F2*(X2-X6)/norm([X2-X6,Y2-Y6,Z2-Z6])*Z2 + F2*(Z2-Z6)/norm([X2-X6,Y2-Y6,Z2-Z6])*(X2-X9)-F3*(X3-X7)/norm([X3-X7,Y3-Y7,Z3-Z7])*Z3 - F3*(Z3-Z7)/norm([X3-X7,Y3-Y7,Z3-Z7])*(X3-X9) + F4* (X4-X7)/norm([X4-X7,Y4-Y7,Z4-Z7])*Z4 + F4*(Z4-Z7)/norm([X4-X7,Y4-Y7,Z4-Z7])*(X4-X9)+ F5*(Z5-Z8)/norm([X5-X8,Y5-Y8,Z5-Z8])*(X5-X9) == 0;
eqn5 = FN == G*b/(2*L);
eqn6 = Fb == 0;
eqn7 = Fcw == 0;
sol = solve(eqn1, eqn2, eqn3, eqn4, eqn5, eqn6, eqn7)
sol =
struct with fields:
F1: [0×1 sym]
F2: [0×1 sym]
F3: [0×1 sym]
F4: [0×1 sym]
F5: [0×1 sym]
FN: [0×1 sym]
Fb: [0×1 sym]
Fcw: [0×1 sym]

Answers (1)

Divija Aleti
Divija Aleti on 30 Oct 2020
If 'solve' returns empty objects ([0x1 sym]), then it means that no solutions exist for the given set of equations.
Divija Aleti
Divija Aleti on 2 Nov 2020
The variable 'sol' is a struct. To access it's first element, type 'sol.F1'. To convert the resulting fraction into a decimal, type 'double(sol.F1)'
ans =
ans =
Similary, you can access F2,F3,F4,F5 and FN.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!