Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started