Solving a system of multiple equations (including vector) for multiple variables
6 ビュー (過去 30 日間)
古いコメントを表示
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)
Results:
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]
0 件のコメント
回答 (1 件)
Divija Aleti
2020 年 10 月 30 日
Hi,
If 'solve' returns empty objects ([0x1 sym]), then it means that no solutions exist for the given set of equations.
2 件のコメント
Divija Aleti
2020 年 11 月 2 日
Hi,
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)'
sol.F1
ans =
-1839148561728237595988134849563078234387089288058877419105564985640547230904797092698406326189288517452891162630896928337354030082617275/77354843129001923831027603919874732687274526293736826906292913237844237799289766460414626081744836930592865352742441940973046586146816
double(sol.F1)
ans =
-23.7755
Similary, you can access F2,F3,F4,F5 and FN.
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!