Question: This practice problem reviews 3 different concepts-using interp1 to interpolate, using diff to differentiate, and using cumtrapz to integrate Write a MATLAB function named my_int_and_diff

 This practice problem reviews 3 different concepts-using interp1 to interpolate, using

This practice problem reviews 3 different concepts-using interp1 to interpolate, using diff to differentiate, and using cumtrapz to integrate Write a MATLAB function named my_int_and_diff that accepts three inputs and has a single output The first input will be a a scalar time value, the second input a list of time values, and the third input a list of velocity values The output should be a structure with fields named tim, pos, vel, and acc The function should numerically integrate velocity to generate position data and it should numerically differentiate (using the forward difference method) velocity to generate acceleration data. After that, it should use interpolation (interp1) at the first input value to calculate the values for the output structure Example clc; t-1:0.1:5; my int_and diff(1.8,t,t.3) Should display this in the command window ans - tim: 1.8e00 pos: 2.380 vel: 5.8320 acc: 10.2700 Your code should work for any set of inputs. Do not include test cases, clear all, etc as part of your submission. This practice problem reviews 3 different concepts-using interp1 to interpolate, using diff to differentiate, and using cumtrapz to integrate Write a MATLAB function named my_int_and_diff that accepts three inputs and has a single output The first input will be a a scalar time value, the second input a list of time values, and the third input a list of velocity values The output should be a structure with fields named tim, pos, vel, and acc The function should numerically integrate velocity to generate position data and it should numerically differentiate (using the forward difference method) velocity to generate acceleration data. After that, it should use interpolation (interp1) at the first input value to calculate the values for the output structure Example clc; t-1:0.1:5; my int_and diff(1.8,t,t.3) Should display this in the command window ans - tim: 1.8e00 pos: 2.380 vel: 5.8320 acc: 10.2700 Your code should work for any set of inputs. Do not include test cases, clear all, etc as part of your submission

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!