Write a code that will import the data from the csv file


Please if possible answer in matlab code that can be subbed straight into matlab. Description (There is a file containing motor data on Blackboard called 'motordata1.csv'.

The first column has time data, while the second column has angular velocity data. In the exercises below, you will be using algorithms to process this data.

Your algorithms need to be able to automatically work for any motor data of a similar style. An alternate piece of motor data called 'motordata2.csv' has been provided, so that you can check whether your code automatically works on data for a different test.

You may assume that the step size for the time vector is constant in your solutions (if you wish). We would like you to answer Q2-Q4 using control structures (if statements, for loops, while loops).

In-built functions can be used to check your answers (eg. for Q3 and for Q4), but should not be used in the solution algorithm.)

1. Write a code that will import the data from the .csv file into MATLAB, and create an angular velocity vs. time plot.

Hint: you will want to use the function.

2. In this experiment, the data collection software is turned on before the motor is switched on. This is why the angular velocity stays at zero to begin with.

Write an algorithm that will automatically cut out the data collected before the motor was turned on. It should also reset the time so that it starts at 0. Use this data when solving the remaining questions.

3. Angular acceleration is the derivative of angular velocity with respect to time. This can be approximated with central finite differences, which states that :

Write a for loop that is able to approximate the angular acceleration using central finite differences.

4. Angular position is the integral of angular velocity with respect to time. This can be approximated with the trapezoid rule, which states that:

Write a for loop that is able to approximate the angular position using the trapezoid rule.

5. Create a subplot that displays your angular position from Q4 as the top plot, angular velocity from Q2 as the middle plot, and angular acceleration from Q3 as the bottom plot.

Hint: You will want to use the function.

Request for Solution File

Ask an Expert for Answer!!
MATLAB Programming: Write a code that will import the data from the csv file
Reference No:- TGS02893440

Expected delivery within 24 Hours