How to take time, angle and speed and plot them to see the course taken?
Show older comments
So I was given a csv file that gives me Time (s), Angle (rad), and Speed (m/s). Here is what I have to do with it:
The data for time, angle, and speed are uniform random values, with directions splattered around the compass. Working from dead reckoning, and assuming an initial position of (0, 0), determine the mean x-displacement, the mean y-displacement, and plot the course taken.
I'm not sure how to do this.
Can anybody help?
1 Comment
the cyclist
on 8 Feb 2013
If you have some idea on how to get started, then I suggest you post the code that you have written, and tell us where you are stuck. Maybe we can give you a boost.
If you really have no idea how to start, then I recommend that you go to your instructor and tell them that, and get some help from them.
Answers (2)
Image Analyst
on 8 Feb 2013
Edited: Image Analyst
on 8 Feb 2013
Did you try csvread() and plot() or scatter()? And mean()? Something like:
dataTable = csvread(fullFileName);
% Compute x,y from dataTable, then...
meanOfX = mean(x);
meanOfY = mean(y);
plot(x, y, 'r0-');
But you need to convert your speed and angle into x and y coordinates using regular trigonometry. In a for loop:
x(k) = x(k-1) + speed(k) * cos(angleInRadians(k));
y(k) = y(k-1) + speed(k) * sin(angleInRadians(k));
That's plenty of hints - probably too many. Give it a try yourself. If it's homework, the protocol is for you to tag your question as homework (I did it for you).
Youssef Khmou
on 8 Feb 2013
hi, I think you should use plot3 :
plot3(time,position,velocity)
As the initial position is mentioned , i think you have to integrate the velocity
so explain more as it asks for (x,y) mean directions, what is your data Nx3 matrix or Nx5 as t x y vx vy ?
Categories
Find more on Mathematics 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!