X_1=input('Force F1 making an angle with x-axis:'); Y_1=input('Force F1 making an angle with y-axis:'); Z_1=input('Force F1 making an angle with z-axis:'); % Force F_2 INPUTS M_2=input('Magnitude of force F2:'); X_2=input('Force F2 making an angle with x-axis:'); Y_2=input('Force F2 making an angle with y-axis:'); Z_2=input('Force F2 making an angle with z-axis:'); % FORCE COMPONENTS F_1= [ M_1*cosd(X_1), M_1*cosd(Y_1), M_1*cosd(Z_1) ] F_2= [ M_2*cosd(X_2), M_2*cosd(Y_2), M_2*cosd(Z_2) ] % RESULTANT FORCES R_1=M_1*cosd(X_1)+ M_2*cosd(X_2) R_2=M_1*cosd(Y_1)+ M_2*cosd(Y_2) R_3=M_1*cosd(Z_1)+ M_2*cosd(Z_2) R=sqrt(power(R_1,2)+power(R_2,2)+power(R_3, 2)) Resultant=[R_1,R_2,R_3] % Angles with the resultants X_R=acosd(R_1/R) y_R=acosd(R_2/R) Z_R=acosd(R_3/R) %Plotting: O_1=[0,0,0]; v_1=[F_1;O_1] %3_d plot plot3(v_1(:,1),v_1(:,2),v_1(:,3),'B--*') hold on grid on v_2=[F_2; O_1] plot3(v_2(:,1),v_2(:,2),v_2(:,3),'G--+') hold on v_3=[Resultant; O_1] plot3(v_3(:,1),v_3(:,2),v_3(:,3),'R--^')