Generate trajectories with same tangent in a specific point

5 views (last 30 days)
I want to simulate the movements of 3 robots/agents in space and I would like to generate 3 different trajectories which have one constraint: in a certain time T the all the trajectories must have the same tangent.
I want something like in the following picture:
Could you please help me figuring out how to do that? I can use MATLAB and also SIMULINK.
Thanks a lot.

Answers (1)

John D'Errico
John D'Errico on 28 Feb 2017
Edited: John D'Errico on 28 Feb 2017
I'm not going to do your homework, as this probably is a piece of your student project.
But if your goal is simply to generate three random trajectories with the desired property, then it is trivial to do.
1. Generate three completely random trajectories.
2. Compute the desired tangent at time t for each trajectory.
3. Rotate trajectories 2 and 3 in the plane so the tangent lines line up with tangent 1.
Will the result be a completely "uniform" sampling of all possible trajectories, subject to the constraint? By the word uniform, I mean that of all possible trajectories that fit your constraint, they will not all be equally likely.
So the set I've shown you how to generate will not be truly uniform. But then you did not ask for that, and this solution will not be a poor one at all in terms of sampling, nor difficult to do.
A truly uniformly sampled set of trajectories would be fairly difficult to generate. If you insisted on that, I'd suggest that you might start from time t, and then work forwards and backwards. To rigorously ensure uniformity in probability even then would be quite difficult, and I'd suggest not worth the extra effort.
John D'Errico
John D'Errico on 28 Feb 2017
No. I don't use polyfix. (Why should I? It can be done in one line of code using lsqlin. And my own spline tools have more capability.)
Next, you never said you wanted a zero slope, just that the tangents needed to be the same.
"all the trajectories must have the same tangent."
Which is it? Zero slope, or parallel curves?
Do I like what you did? Not really, because I don't really like polynomial fits, even though I provided polyfitn on the FEX. :)
You are essentially restricting the set of trajectories to the set of polynomials in the plane that have a zero slope at that point. I talked about the problem with uniformity but this is not a uniform sampling of curves.
Hey, I'm not being any easier on you than I would were I on your thesis committee, and I expect they should be as demanding.
So my questions are
1. What is a clear definition of a "trajectory"? Should it be possible for a trajectory to cross itself? Could a closed curve such as a circle qualify as a trajectory?
2. Do you really want the slope to be zero at some fixed point?

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!