Solving a simple vectorial equation with one unknown
4 次查看(过去 30 天)
显示 更早的评论
Hello,
I would like to ask for help with the following case. I have a vectorial equation where there is a cross product, and the unknown 'x' is within the cross product.
The equation is simply the cross product between two vectors, which is equal to the torque being applied to a rotating system.
The code is the following:
P = [126.7611; -118.5356; 331.2583]; % Point P, at which force is applied
A = [161.0000; -118.5258; 323.7618]; % Point A on axis of rotation
AB = [0; 1.0000; -0.0005]; % AB Unit Vector of axis around which torque is applied
CD = [-0.0438; -0.2179; -0.9750]; % CD Unit Vector of droplink
T = [0; -4806.2; 0]; % Torque Magnitude
% Find AP, AP = P-A
AP = P - A;
% Find point O, projection of P on AB
O = A + dot(AP,AB) * AB;
% Find Vector OP, OP = P-O
OP = P - O;
% State Equation to solve:
% Actual equation is: T = cross(OP,x*CD)
f = @(x)[cross(OP,x*CD) - T];
xSol = fsolve(f, 0, opts);
My question is whether this is the correct way of solving this equation, and also why am I getting the following error when the code is executed:
Warning: Trust-region-dogleg algorithm of FSOLVE cannot handle non-square systems; using Levenberg-Marquardt algorithm instead.
Many thanks for your help in advance.
C
0 个评论
回答(1 个)
Bruno Luong
2021-1-5
编辑:Bruno Luong
2021-1-5
fsolve requires the number of unknowns == number of equations.
This is the least-square solution
f = @(x)norm([cross(OP,x*CD) - T])^2;
xSol = fsolve(f, 0)
Or you can just compute directly without using any fancy solver
x = T.'/cross(OP,CD).'
2 个评论
Bruno Luong
2021-1-5
编辑:Bruno Luong
2021-1-5
This is warning, since the least square solution does not make the solution to exactly match T. Normal: your T is not perpendicular to OP and CD and cannot be written as they cross product.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Systems of Nonlinear Equations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!