1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
| clear
syms theta_s theta_v theta_f t1 t2 theta_s=60; theta_v=120; theta_f=30; t1=1; t2=1;
theta0=theta_s; theta_g=theta_f; t_f=t1;
a10=theta0; a11=0; a12=(12*theta_v-3*theta_g-9*theta0)/(4*t_f^2); a13=(-8*theta_v+3*theta_g+5*theta0)/(4*t_f^3); a20=theta_v; a21=(3*theta_g-3*theta0)/(4*t_f); a22=(-12*theta_v+6*theta_g+6*theta0)/(4*t_f^2); a23=(8*theta_v-5*theta_g-3*theta0)/(4*t_f^3);
syms theta(t) theta=piecewise(0<=t<t1,a10+a11*t+a12*t^2+a13*t^3,t1<=t<=t1+t2,a20+a21*(t-t1)+a22*(t-t1)^2+a23*(t-t1)^3) theta1=diff(theta) theta2=diff(theta1) theta3=diff(theta2)
subplot(2,2,1) fplot(theta,[0,2]) xlabel('s') ylabel('deg') title('position') subplot(2,2,2) fplot(theta1,[0,2]) xlabel('s') ylabel('deg/s') title('velocity') subplot(2,2,3) fplot(theta2,[0,2]) xlabel('s') ylabel('deg/s^{2} ') title('acceleration') subplot(2,2,4) fplot(theta3,[0,2]) xlabel('s') ylabel('deg/s^{3} ') title('acceleration change rate')
|