t=0 : dt : tmax;mpts=length(t);for i=1:mpts if (t>=0) & (t<=t1) rd(i)=a1*t.^3+b1*t.^2; r(i)=((1/4)*a1*t.^4)+((1/3)*b1*t.^3); elseif (t>t1) & (t<=t2) rd(i)=m; r(i)=m*(t-t1)+k1; else rd(i)=a3*t.^3+b3*t.^2+c3*t+d3; r(i)=a3/4*(t.^4-t2.^4)+b3/3*(t.^3-t2.^3)+c3/2*(t.^2-t2.^2)+d3*(t-t2)+k2; end end
The error occurs at the final 'rd(i)' section, I'm at a loss as to why! t1, t2 and t3 are all defined above this section of code. As is m, k1 and k2.
Any help is much appreciated!
Best Answer