- Introduction
An accelerometer has been used to record the motion of an object. The log is available as
“ass1data.csv” from the Study Desk. Your task is to determine what the motion was and characterise
it.
One of the key activities when conducting data analysis is to determine whether you have
correctly loaded the data according to what you intended, so your first task is to check that the
numbers in your MATLAB variables correspond with the values you input.
To determine the recorded motion of the phone, you should initially plot the x- and y-
components of linear acceleration versus time. Your final plot should plot the y-position versus the x-
position so that you can visualise the motion. To determine the position in a particular direction, you
will need to integrate the acceleration:
v t a dt
With the initial conditions that the object starts at the origin and is stationary, you are able to compute
the velocity by:
vel = cumsum(acc)*dt;
where vel is a velocity component, acc is the corresponding acceleration and dt is the change in
time between measurements. You can perform a similar calculation to compute the position from the
velocity.
To characterise the behaviour, you should compute the apparent period of the acceleration in
the x-direction.
To report your results, you should save the x- and y-positions in a file so that someone could
reproduce the original data.
Requirements
For this assessment item, you must produce MATLAB code which:
1. Loads the data file.
2. Checks that the values that have been loaded into MATLAB correspond to the values in the
data file. You should confirm this is the case by displaying in the Command Window the first
5 values of time, x-acceleration and y-acceleration and displaying a statement that you have
confirmed that these values are correct.
3. Plots the data for the x-acceleration and y-acceleration versus time.
4. Computes the x-position and y-position.
5. Plots the x-position and y-position versus time.
6. Plots the y-position versus the x-position.
7. Displays a message in the Command Window with your prediction of what the motion was.
8. Calculates the period of the motion and returns the value to the Command Window.
9. Stores the data for the x-position and y-position in an ASCII file so that it could be used to
plot the x-position and y-position versus time and versus each other by someone else writing a
different code.
10. Has appropriate comments throughout.