Filter löschen
Filter löschen

Non linearly spaced points using a time vector in MATLAB

7 Ansichten (letzte 30 Tage)
Nick am 11 Aug. 2016
Kommentiert: Nick am 12 Aug. 2016
I have a vector which contains a trajectory for an end effector of a robot. During each sample the next point in the trajectory is sent to the device. In other words, the trajectory vector only contains the points in 3D-space which are spaced linearly using linspace().
I, on the other hand, don't want them to be spaced linearly. I want to create a time vector which defines the spacing of the points. So if I would use a non linear curve (S-Curve for example) the beginning and the end of the trajectory should be spaced closer to each other whereas the points in between have a larger spacing. This should result in slower and smoother movements of the robot at the beginning and the end of the trajectory.
Is there a function in MATLAB similar to linspace which accepts, for example, a time vector and based on that generates a vector of non-linearly spaced points?
If not, how would I go about creating something like this?
  2 Kommentare
Pham Dang
Pham Dang am 11 Aug. 2016
Hi, if I well understand, you send the target position at equally spaced instants to your system. This can not be changed and you want to change its speed by computing the proper unequally spaced positions. Am I wrong ?
If I'm right, did you consider integrating the target speed vector with cumsum ?
Nick am 12 Aug. 2016
You are correct. To visualize this, all the trajectories are spaced according to a straight diagonal line which is a time vs. samples plot.
I want to create something which accepts any time vs. samples curve which defines how fast certain samples (and their respective interpolated values) should be played back.
For instance I might want to play back the first few 100 samples over a longer period of time and afterwards play them back at much faster rates. The time vs. sample curve would look like an exponential function.
I can hard code the interpolation function with a predefined time/sample curve but I want to create a function which accepts a linearly spaced vector and a time/sample matrix and returns the newly interpolated vector.
The timeseries object can do that something like that, but it's very slow and it has to work in a real-time environment (codegen).

Melden Sie sich an, um zu kommentieren.

Antworten (0)


Mehr zu Coordinate Transformations finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by