Equation of three variables but...

Hello, I've got an equation which I don't know how to solve in Matlab.
F1*cos(alpha1) + F2*cos(alpha2) = 0
F1*sin(alpha1) - F2*sin(alpha2) = F3
-F2*sin(alpha2)*a + F2*cos(alpha2)*b = F3*c
Variables: F1 | F2 | alpha2
a = 330, b=183, c=124, F3 = 1200, alpha1 = 50°
Is there a way to solve it?

Answers (2)

syms F1, F2, alpha2
a = 330; b=183; c=124; F3 = 1200; alpha1 = 50;
[F1sol, F2sol, alpha2sol] = solve( F1*cosd(alpha1) + F2*cosd(alpha2), F1*sind(alpha1) - F2*sind(alpha2) - F3, -F2*sind(alpha2)*a + F2*cosd(alpha2)*b - F3*c, {F1, F2, alpha2} );
You might want to simplify() the results.
The result might perhaps have a RootOf() in F2 and alpha2.
The result will be symbolic rather than numeric. If you want the numeric result, use double() around the answers.
Note: there are two answers. F1 is the same for both, F2 is positive of negative of the same value for both, and alpha2 differs between the two.
I tried something similar the another time but I hit the wall with:
Undefined function 'cosd' for input arguments of type 'sym'.
I don't know what's the problem here. Can't have "sym" in cos / sin / tan etc.? So still not solved.

9 Comments

Ok so I found that sym/s can't go well with cosd sind etc. But they're good with cos sin etc. So I recalculated degrees to radians, but:
syms F1 F2 alpha2
a = 330; b=183; c=124; F3 = 1200; alpha1 = 50;
alpha1rad = alpha1 * pi/180 %degree to radians
[F1sol, F2sol, alpha2sol] = solve( ...
F1*cos(alpha1rad) + F2*cos(alpha2),...
F1*sin(alpha1rad) - F2*sin(alpha2) - F3,...
-F2*sin(alpha2)*a + F2*cos(alpha2)*b - F3*c,...
{F1, F2, alpha2} )
and the answer was:
alpha1rad =
0.8727
Error using char
Cell elements must be character arrays.
Error in solve>tochar (line 289)
vc = char(v);
Error in solve>getEqns (line 254)
vc = tochar(v);
Error in solve (line 150)
[eqns,vars,options] = getEqns(varargin{:});
Error in XXXrovnice (line 9)
[F1sol, F2sol, alpha2sol] = solve( ...
Try
[F1sol, F2sol, alpha2sol] = solve( ...
F1*cos(alpha1rad) + F2*cos(alpha2),...
F1*sin(alpha1rad) - F2*sin(alpha2) - F3,...
-F2*sin(alpha2)*a + F2*cos(alpha2)*b - F3*c,...
F1, F2, alpha2 )
Thanks, the numerics are working, but... I still don't know the solution. My equations are (a little rewritten to match my program):
syms F_I F_C alpha_C_rad
a = 482.23; b=155.09; c=198.61; d=a-b; Fg = 1200; alpha_I = 61.72;
alpha_I_rad = alpha_I * pi/180; %degree to radians
display(' Uvolnění k bodu C ')
[F_C_sol, F_I_sol, alpha_C_sol] = solve( ...
F_I*cos(alpha_I_rad) - F_C*cos(alpha_C_rad) ==0 , ...
F_I*sin(alpha_I_rad) + F_C*sin(alpha_C_rad) - Fg == 0, ...
-F_I*cos(alpha_I_rad)*(c)-F_I*sin(alpha_C_rad)*(a) + Fg*(d) == 0, ...
F_I, F_C, alpha_C_rad)
F_I = subs(F_I_sol);
disp(['F_I = ' num2str(F_I) ' N']);
F_C = subs(F_C_sol);
disp(['F_C = ' num2str(F_C) ' N']);
alpha_C_rad = subs(alpha_C_sol);
alpha_C = alpha_C_rad / (pi/180);
disp(['alpha_C = ' num2str(alpha_C) ' N']);
The answer was:
F_I = 1641.2206 N
F_C = -815.362 N
alpha_C = 162.4893 N
SR Suma(X) = -1.1369e-13 N ... (mělo by být = 0)
SR Suma(y) = 2.2737e-13 N ... (mělo by být = 0)
SR Suma(MoC) = -458.848 Nm ... (mělo by být = 0)
SR Suma(MoI) = -458.848 Nm ... (mělo by být = 0)
Where SR SUMA (X), (Y), (MoC) (MoI) should be ZERO. In this particular case it is zero for (X) and (Y) but not for the moment MoC / MoI.
I still don't have the answer. Starting to feel pretty desperate :-/ The problem is this:
Remember roundoff.
As you are working symbolically, I recommend you use
alpha_I_rad = alpha_I * sym('pi/180'); %degree to radians
Thanks, good idea. But still bad numbers. :-( Maybe I'm doing something bad... I don't know.
What are SR Suma(X) and so on?
After quite a bit of work, I determined that if all of your constants a, b, etc., are taken as being accurate to 10 digits, then the equations have two real solutions (and two imaginary solutions) with the real solutions being
F_I = 1640 +/- 0.0129
F_C = -815 +/- 0.0484
alpha_C_rad = -0.306 +/- 0.0000185
or alternately
F_I = -1050 +/- 0.00525
F_C = -2180 +/- 0.0258
alpha_C_rad = -1.34 +/- 0.00000241
(Bleh! I hate having to fight the tools I'm using!!)
Remember, this assumes your constants are 10 digits accurate, which does not appear to be at all justified given their two digits after the decimal place values. It would take me a bunch more work to figure it out under the normal assumption that something given to 2 decimal digits should represent accuracy within +/- 0.005. (Now I know what to watch out for in the tools, but it is still a pain.)
SR Suma(X) is sum of forces affecting x orientation (horizontal)
SR Suma(Y( is sum of all forces affecting y orientation (vertical)
SR Suma(MoC) is sum of moments (force x didstance) to one point (C)
I've got the result.
F_C must be cca 643.1N
F_I must be 756.2N
alpha_C must be 56.1° (degree)
My methods for this were two.
(1)
From the third equation express F_I. I've got 756,2N
Then 1. and 2. equations do square and I've got:
F_C^2 *cos^2(alpha_C) = F_I^2*cos^2(alpha_I)
F_C^2 *sin^2(alpha_C) = (Fg - F_I * sin(alpha_I))
1. -> add (sum?) -> 2.
F_C = sqrt(756.2^2*cos^2(61.72)+(1200-756.2*sin(61.72))^2) which is 643 and the alpha from 1. equation is 56.1°
The second method:
(2)
From the third equation express F_I -> 756,2N
Then the 1st & 2nd equation divide (1)/(2) which get me:
-cotan(alpha_C) = (F_I*cos(alpha_I))/(Fg - F_I*sin(alpha_I))
alpha_C = arcus cotangens... -> 56.1°
Then from 1st equation -> F_C = 643N
But I don't know how to do this only with the help of matlab. F_I = 1640 / -1050 | F_C = -2180 / -815 is incorrect. :-) But man I'm glad I found the right result.
How can you use the third equation to expression F_I in one step? The third equation involves alpha_C_rad, so you would only be able to express it dependent on alpha_C_rad instead of getting a numeric value in one step ??
Ah, sorry. I was referring to this system of equation:
One has
-F_I*cos(alpha_I)*c-F_I*sin(alpha_I)*a+Fg*d = 0
The other has
F_C*sin(alpha_C)*a-F_C*cos(alpha_C)*c-Fg*b = 0
The equations -must- be equal so I chose the first one.
If I chose the second, I don't seem too have the ability to solve the system of equations. And if I try it in matlab, it gives me different results (F_C, F_I, alpha_C) so I have chosen the first one where the only variable is F_I.
(Not the task I wrote in the first question, I know. Sorry.)

Sign in to comment.

Asked:

on 28 Mar 2013

Community Treasure Hunt

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

Start Hunting!