Effacer les filtres
Effacer les filtres

Solving a simple vectorial equation with one unknown

8 vues (au cours des 30 derniers jours)
Carlos Acasuso
Carlos Acasuso le 5 Jan 2021
Modifié(e) : Bruno Luong le 5 Jan 2021
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.

Réponses (1)

Bruno Luong
Bruno Luong le 5 Jan 2021
Modifié(e) : Bruno Luong le 5 Jan 2021
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 commentaires
Carlos Acasuso
Carlos Acasuso le 5 Jan 2021
Hello Bruno,
Many thanks for your reply.
I am just trying to compare both methods you've pointed, but using fsolve I get the error below. I still also do not understand why are you using norm to calculate the vector magnitude of [cross(OP,x*CD) - T], and then squaring it.
No solution found.
fsolve stopped because the last step was ineffective. However, the vector of function
values is not near zero, as measured by the value of the function tolerance.
<stopping criteria details>
Many thanks again for your help.
Bruno Luong
Bruno Luong le 5 Jan 2021
Modifié(e) : Bruno Luong le 5 Jan 2021
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.

Connectez-vous pour commenter.




Community Treasure Hunt

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

Start Hunting!

Translated by