Hello y'all! I'm having a problem while trying to plot the values of 9 forces to each angle between 0 and 360°. The algorithm is shown below. The vectors "R" (like R12x) are known (they'll be calculated for every increment of the angle O2x) and so are the values of the matrix F. The thing is, I messed something up and it's plotting the values of the forces ONLY for the angle 360°! No matter what I do. The results of R=A\F are nine forces, and I want to plot their graphic for every angle increment.
Also, it's saying that some values of both matrixes A and F are imaginary values… I'm afraid that using abs will result in values which are not the right ones… anyway…
Can someone help me? Thank you in advance!
if trueangle=zeros(360);force=zeros(360,9);for i=1:1:360angle_O2x = i;angleO31=2*atan(((-(-2*sind(angle_O2x)))-sqrt(((-2*sind(angle_O2x))^2)-4*(cosd(angle_O2x)-(C1/C2)+(C1/C3)*cosd(angle_O2x)+((C4^2-C1^2-C2^2-C3^2)/(2*C2*C3)))*((C1/C2)+((C1/C3)-1)*cosd(angle_O2x)+((C4^2-C1^2-C2^2-C3^2)/(2*C2*C3)))))/(2*(cosd(angle_O2x)-(C1/C2)+(C1/C3)*cosd(angle_O2x)+((C4^2-C1^2-C2^2-C3^2)/(2*C2*C3)))));angle_O41=2*atan(((-(-2*sind(angle_O2x))-sqrt(((-2*sind(angle_O2x))^2)-4*(cosd(angle_O2x)-(C1/C2)-(C1/C4)*cosd(angle_O2x)+((C1^2+C2^2-C3^2+C4^2)/(2*C2*C4)))*((C1/C2)-((C1/C4)+1)*(cosd(angle_O2x))+((C1^2+C2^2-C3^2+C4^2)/(2*C2*C4)))))/(2*(cosd(angle_O2x)-(C1/C2)-(C1/C4)*cosd(angle_O2x)+((C1^2+C2^2-C3^2+C4^2)/(2*C2*C4))))));R12x=-R12*cosd(angle_O2x);R12y=-R12*sind(angle_O2x);R32x=(C2*cosd(angle_O2x))-(R12*cos(angle_O2x));R32y=(C2*sind(angle_O2x))-(R12*sin(angle_O2x));R23x=-R23*cos(angleO31);R23y=-R23*sin(angleO31);R43x=(C3*cos(angleO31))-(R43*cos(angleO31));R43y=(C3*sin(angleO31))-(R43*sin(angleO31));R14x=-R14*cos(angle_O41);R14y=-R14*sin(angle_O41);R34x=(C4*cos(angle_O41))-(R34*cos(angle_O41));R34y=(C4*sin(angle_O41))-(R34*sin(angle_O41));A = [1 0 1 0 0 0 0 0 0; 0 1 0 1 0 0 0 0 0; -R12y R12x -R32y R32x 0 0 0 0 1; 0 0 -1 0 1 0 0 0 0; 0 0 0 -1 0 1 0 0 0; 0 0 R23y -R23x -R43y R43x 0 0 0; 0 0 0 0 -1 0 1 0 0; 0 0 0 0 0 -1 0 1 0; 0 0 0 0 R34y -R34x -R14y R14x 0];F = [m2*a2x;m2*a2y;Icm2*a2;m3*a3x-Fpx;m3*a3y-Fpy;Icm3*a3-(Rpx*Fpy)+(Rpy*Fpx);m4*a4x;m4*a4y;Icm4*a4-T4];R=A\F;angle(i)=angle_O2x;force(i,:)=R(:);endplot(angle(i),force(i,:));axis([1,360,-2,2]) % code
end
Best Answer