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!