Below is my code. I am trying to obtain a value for the Torque at the end, for each value of theta. As you can see thetas are stored in an array with 3 values. I am aiming for the programme to step through the code for every value, therefore producing 3 values of torque at the end. The code I have produced only seems to step through once. Any help would be greatly appreciated.
l1 = 0.09;l2 = 0.09;l3 = 0.095;l4 = 0.11;l5 = 0.115;theta_1 = [45,35,30];theta_2 = [135,80,55];theta_3 = [0,45,90];theta_4 = [45,5,6.5];theta_5 = [135,45,40];Wb = 10; %Weight of baby in kg
Ws = 10; Wp = 9.81*Wb; %Payload weight, baby weight multiplied by gravity.
for i = 1:3a = (l1*cosd(theta_1(i)));b = (l2*cosd(theta_2(i)));c = (l4*cosd(theta_3(i)));d = (l5*cosd(theta_3(i)));e = (l2*cosd(theta_4(i)));f = (l1*cosd(theta_5(i)));g = (l3*cosd(theta_3(i)));h = (a+b-g);eqn1 = ((Wp*(h))+(Ws*(a+b+c)))/(a+b+c+d+e+f); %Solve for Rb
ReacB = eqn1;eqn2 = Wp + Ws - eqn1; %Solve for Ra
ReacA = eqn2;eqn3 = (Wp*(b-g))+(Ws*(b+c)); %TorquePosition1
eqn4 = (Wp*g)+(Ws*c); %TorquePosition2
eqn5 = (Wp*(g+c+d))+(Ws*(d)); %TorquePosition3
eqn6 = (Wp*(g+c+d+e))+(Ws*(d+e)); %TorquePosition4
Tor1=eqn3;Tor2=eqn4;Tor3=eqn5;Tor4=eqn6;end Tor1;Tor2;Tor3;Tor4;%MaxTor(i) = MaxTorque
Best Answer