Hi,
So the main mistake that I had is when I tried to set by randomize F1 inside the friction cone. the solution for this problem has 3 DOF and by setting F1 in a space which is not linear wuth the solution from this type:
So when I set another 3d vector of F1 as unkown the solution brings the coefficient C1,C2 and C3.
*The forces has inner forces that cancles each other and thats the reason I can't determinate one force in the cone of friction regardeless the this assumption
Now all I have to do is to check if for any combination of those coefficient there is a particular solution for the problem.
adding the script of the solution for those who wants to run it
clc; clear; close all;
% Known forces and weight
F2 = [4; 5; 1]; % User's input force
W = [0; 0; -10]; % Increased weight for better force balance
% Positions of leg tips and center of mass (ensuring asymmetry)
x1 = 0; y1 = 0; z1 = 0; %F1 - Unkown force
x2 = 1; y2 = 0; z2 = 0; %F2 - user's input force
x3 = 0; y3 = 1; z3 = 0; %F3 - unkown force
x4 = 0.85; y4 = 0.9; z4 = 0.15; %F4 - unkown force
xCOM = 0.2; yCOM = 0.2; zCOM = 0.5; %COM location
% Position vectors relative to leg 2 - the users input force
r1 = [x1 - x2; y1 - y2; z1 - z2];
disp("r1= ")
disp(r1)
r2 = [x2 - x2; y2 - y2; z2 - z2];
disp("r2= ")
disp(r2)
r3 = [x3 - x2; y3 - y2; z3 - z2];
disp("r3= ")
disp(r3)
r4 = [x4 - x2; y4 - y2; z4 - z2];
disp("r4= ")
disp(r4)
rCOM = [xCOM - x2; yCOM - y2; zCOM - z2];
disp("rCOM= ")
disp(rCOM)
% Define unknown forces
syms F1x F1y F1z F3x F3y F3z F4x F4y F4z
F1 = [F1x; F1y; F1z];
F3 = [F3x; F3y; F3z];
F4 = [F4x; F4y; F4z];
% Force equilibrium equation (sum of forces must be zero)
eq1 = F1(1) + F2(1) + F3(1) + F4(1) + W(1) == 0; %Fx
disp("eq1= ")
disp(eq1)
eq2 = F1(2) + F2(2) + F3(2) + F4(2) + W(2) == 0; %Fy
disp("eq2= ")
disp(eq2)
eq3 = F1(3) + F2(3) + F3(3) + F4(3) + W(3) == 0; %Fz
disp("eq3= ")
disp(eq3)
% Moment equilibrium equation (sum of moments must be zero)
M1 = cross(r1, F1);
disp("M1= ")
disp(M1)
M2 = cross(r2, F2);
disp("M2= ")
disp(M2)
M3 = cross(r3, F3);
disp("M3= ")
disp(M3)
M4 = cross(r4, F4);
disp("M4= ")
disp(M4)
MCOM = cross(rCOM, W);
disp("MCOM= ")
disp(MCOM)
eq4 = M1 + M3 + M4 + MCOM == 0;
disp("eq4= ")
disp(eq4)
% Convert equations to matrix form A * X = B
[A, B] = equationsToMatrix([eq1; eq2; eq3; eq4], [F1x, F1y, F1z, F3x, F3y, F3z, F4x,F4y, F4z]);
% Display the system matrix and RHS vector
disp('Matrix A:');
disp(A);
disp('Vector B:');
disp(B);
disp("NULLL")
disp(null(A));
NULL=null(A);
% Check the rank of A
rank_A = rank(A);
disp('rank of A:');
disp(rank_A);
% Display the system matrix and RHS vector
disp('Matrix A:');
disp(A);
disp('Vector B:');
disp(B);
% Solve the system
if rank_A == size(A, 1) % Full rank, unique solution exists
X = linsolve(A, B);
disp('Xp Solution for F3 and F4 :');
disp(X);
disp('Xh Solution for F3 and F4 :');
disp("C1* ")
disp(NULL(:,1));
disp("C2* ")
disp(NULL(:,2));
disp("C3* ")
disp(NULL(:,3));
force_norm = norm(A * X - B); % ||Ax - B|| should be small if the solution is good
moment_norm = norm(cross(r1, X(1:3)) + cross(r3, X(4:6))+ cross(r4, X(7:9))+MCOM);
disp('Norm of force residuals:');
disp(round(force_norm, 5));
disp('Norm of moment residuals:');
disp(round(moment_norm, 5));
disp("Done")
end