i=0;
thetaf = -0.005054045;
for t = 0:0.01:0.1
tf=0.1;
theta0 = 0.00885953175658278;
a0 = theta0;
i = i+1;
a1 = 0;
a2 = (3/tf^2)*(thetaf-theta0);
a3 = (-2/tf^3)*(thetaf-theta0);
time(i,1) = t;
theta(i,1) = a0 + a1*t + a2*t^2 + a3*t^3;
end
for t = 0.2:0.01:0.3
tf=0.3;
theta0 = 0.105469202;
a4 = theta0;
a5 = 0.966096702;
a6 = (3/tf^2)*(thetaf-theta0);
a7 = (-2/tf^3)*(thetaf-theta0);
i = i+1;
time(i,1) = t;
theta(i,1) = a4 + a5*t + a6*t^2 + a7*t^3;
end
for t = 0.4:0.01:0.5
tf=0.5;
theta0 = 0.079567522;
a8 = theta0;
a9 = -0.1295084;
a10 = (3/tf^2)*(thetaf-theta0);
a11 = (-2/tf^3)*(thetaf-theta0);
i = i+1;
time(i,1) = t;
theta(i,1) = a8 + a9*t + a10*t^2 + a11*t^3;
end
for t = 0.6:0.01:0.65
tf=0.6;
theta0 = 0.040306469;
a12 = theta0;
a13 = -0.196305266;
a14 = (3/tf^2)*(thetaf-theta0);
a15 = (-2/tf^3)*(thetaf-theta0);
i = i+1;
time(i,1) = t;
theta(i,1) = a12 + a13*t + a14*t^2 + a15*t^3;
end
for t = 0.70:0.01:0.73
tf=0.73;
theta0 = -0.074996897;
a16 = theta0;
a17 = -1.153033654;
a18 = (3/tf^2)*(thetaf-theta0);
a19 = (-2/tf^3)*(thetaf-theta0);
i = i+1;
time(i,1) = t;
theta(i,1) = a16 + a17*t + a18*t^2 + a19*t^3;
end
for t = 0.80:0.01:0.87
tf=0.87;
theta0 = -0.043367639;
a20 = theta0;
a21 = 0.24330198;
a22 = (3/tf^2)*(thetaf-theta0);
a23 = (-2/tf^3)*(thetaf-theta0);
i = i+1;
time(i,1) = t;
theta(i,1) = a20 + a21*t + a22*t^2 + a23*t^3;
end
for t = 0.9:0.01:1
tf=1;
theta0 = 0.002141521;
a24 = theta0;
a25 = 0.325065431;
a26 = (3/tf^2)*(thetaf-theta0);
a27 = (-2/tf^3)*(thetaf-theta0);
i = i+1;
time(i,1) = t;
theta(i,1) = a24 + a25*t + a26*t^2 + a27*t^3;
end
figure(1)
plot(time,theta)
xlabel('Time(t,sec)','FontSize',14)
ylabel('Angle(degrees)','FontSize',14)
title('\it{Position Profile for Hip}','FontSize',16)