Velocity vs Time data while drawing with mouse pointer
1 view (last 30 days)
Show older comments
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.
0 Comments
Accepted Answer
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.
You might also wish to look at http://uk.mathworks.com/matlabcentral/answers/259577-how-to-record-mouse-coordinates-in-fixed-interval-like-0-01ms
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.)
More Answers (0)
See Also
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!