Velocity vs Time data while drawing with mouse pointer

1 view (last 30 days)
Hi everyone. I will be very grateful for any opinion on my matter:
Briefly, I need to calculate velocity over time, while drawing a circle. For instance I start to draw the circle with constant velocity and subsequently slow down. I have to draw some kind of a graph attached.
It doesn't always have to be circle but the curve i draw should have continuity and non-linearity. I can write the code for polygons using the start and finish coordinates of the straight lines with tic-toc function. However for continuous curves, i unfortunately have no idea.
All help would be so appreciated.

Accepted Answer

Walter Roberson
Walter Roberson on 10 Dec 2015
This does not record the time of the events, but you can ask for the current time when the event is serviced; it will be a bit inaccurate though.
Once you have the points and the time, you can calculate point-to-point distance using Euclidean distance calculations. That will not give you velocity as you need at least one further point in order to calculate relative direction. I notice, however, that in your question you are not plotting velocity, you are plotting instantaneous speed. (Remember: velocity is a vector, a direction and magnitude pair, not just magnitude.)
  1 Comment
Adelante
Adelante on 10 Dec 2015
Dear Walter Roberson,
Thank you for your rapid reply. The graph was an example to simplify the question, I actually need to record coordinates for very short time interval, therefore your second suggestion would work, I suppose.
Regards

Sign in to comment.

More Answers (0)

Categories

Find more on 2-D and 3-D Plots in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!