1D trapezoidal trajectory


A commonly used alternative velocity profile looks like this. We accelerate. We move at constant velocity for as long as we need to and then we slow down as quickly as we can. An advantage of a trajectory like this is that we get to our destination much more quickly. The area under the two curves is the distance travelled, and that's the same in the two cases. It’s just that the red curve is much more compact. It only takes 35 time units instead of 50 time units.

This kind of motion is referred to as a trapezoidal profile. It's named after the shape of the velocity profile. It’s a trapezoid. It comprises an acceleration phase, a coasting phase - where we move at a constant velocity - and then a deceleration phase. During acceleration and deceleration, the velocity is a linear function of time. Which means, that position is a parabolic function of time. During the coasting phase, the velocity is constant. That means that the position profile is a straight line. So, this kind of motion profile, the trapezoidal profile, is also sometimes referred to as a linear segment with parabolic blend. In that robotics toolbox, it’s the function LSPB which is a contraction of a linear segment with parabolic blend.

A disadvantage of the trapezoidal profile is that acceleration is not continuous and you can see it when we change from acceleration phase to coasting phase and coasting to deceleration phase, there is a step discontinuity in acceleration. This is potentially problematic for some robots but in general, we rely on the fact that the bandwidth of the motion control systems is relatively low and it smooths out this discontinuity in acceleration.

Let's look at this type of trajectory using the MATLAB tools, I am going to create a trapezoidal trajectory using the MATLAB function LSPB which is an acronym for Linear Segment with Parabolic Blend. It's going to start with the value of zero. It's going to finish at one. We're going to do it in 50 times steps. And, here we see the trajectory. We can clearly see that the velocity profile is trapezoidal. We can see the acceleration phase, the constant velocity phase and the deceleration phase. And, these different phases are color coded in the plot of S versus time step. I can change the trajectory. So, instead of going from zero to one, it goes from zero to minus one. And, the trajectory now looks like this. So, then, I can ask for the values of S, from zero to one in 50 times steps. And it creates a vector in the workspace code S which has 50 rows. Each row corresponds to a time step. And just like the tpoly function, I can also ask for the velocity and the acceleration which in turn, we put into the workspace SD and STD and here they are also in the workspace as 50 element vectors, one row per time step.

I'm going to return to my first example. A trajectory from zero to one. We can see that the velocity of the linear segment is a little bit above 0.03. What we are going to do now is to override the automatic choice of the velocity of the linear segment. And, I'm going to suggest that it use a value of 0.025 instead. And, here we can see the trajectory is being computed. You see that the linear segment now is much longer and the parabolic blends are much shorter. I am going to suggest that it uses a slightly larger value of velocity for the linear segment. And, now we can see linear segment's quite short and the parabolic blends are longer. The range of feasible values for the velocity of the linear segment are actually quite limited. And, if I suggest a value of 0.02, it is returning an error indicating that the velocity that I specified is too small. It's not possible to compute a trapezoidal profile with that value of velocity for the linear segment.


There is no code in this lesson.

A more efficient trajectory has a trapezoidal velocity profile.

Professor Peter Corke

Professor of Robotic Vision at QUT and Director of the Australian Centre for Robotic Vision (ACRV). Peter is also a Fellow of the IEEE, a senior Fellow of the Higher Education Academy, and on the editorial board of several robotics research journals.

Skill level

This content assumes high school level mathematics and requires an understanding of undergraduate-level mathematics; for example, linear algebra - matrices, vectors, complex numbers, vector calculus and MATLAB programming.

More information...

Rate this lesson


Check your understanding


  1. Prashant says:

    The non-zero initial velocity causes
    the polynomial to overshoot the terminal value – it peaks at 5 on a trajectory from 0 to 1.
    sir can you explain this line.

    1. Peter Corke says:

      I think your question relates to a different lesson, the one about polynomial trajectories starting at 4:28. Please repost your question on lesson page and be more explicit about your question.

  2. Anas says:

    Hi Prof. Corke,

    I find this text is a bit unclear”we rely on the fact that the bandwidth of the motion control systems is relatively low and it smooths out this discontinuity in acceleration.” could you kindly clarify it.

    with thanks

    1. Peter Corke says:

      It is a bit of a hand waving comment. A discontinuous input, a signal that is stepped not smooth, can be considered in the frequency domain as having frequency components out to infinity. Motion control systems have a finite bandwidth, so the the resulting motion will be a smooth low-pass filtered version of the input. Does that help?

  3. AstroPrite says:

    Thank you for the good lecture!

    Is it possible not having the coasting phase, it would make the robot quicker?

    1. Peter Corke says:

      It would be quicker, but ultimately any joint has a maximum velocity, so if the motion is over a long distance/angle, at some point you will have to move at that maximum which is coasting.

    2. bharath says:

      another way to look around is that if there is no coasting phase the acceleration has to change very fast (positive to negative) which should be avoided.

  4. bharath says:

    Hi Prof. Corke,
    Can we get the bounds on the minimum and maximum velocities? and on which parameters that these bounds depend? (can it be the order of polynomial … )

    Please give your thoughts on this doubt

    Thanks in advance

Leave a comment