Question: In this part, write a function [out] differences (in) that inputs 1 array and outputs 1 array. The output array will be the differences between

 In this part, write a function [out] differences (in) that inputs

In this part, write a function [out] differences (in) that inputs 1 array and outputs 1 array. The output array will be the differences between each pair of consecutive values in the input array. The input can be of any length but the output will always have one item less than the input. You must write your function using either basic array manipulation or forlwhile loops -you may NOT use existing MATLAB functions. 10 in out In the above example, the input array in represents the first 10 values in the number sequence described by in = x2 where x is the position in the array. The output array out is simply the 9 differences between consecutive values. Notice, also, that out represents the number sequence described by out 2x +1. This is a perfect example of numerical differentiation. Notice that after calculating the differences, the second- order polynomial (x2) is reduced to a first-order (2x +1). Now, apply the differences function you have just written,to the velocity time series generated in WSA4, Part 4. Your velocity array should have been 450 values long, thereforeR your output array will be 449 values long. 0.1 You can plot your output array like this: output differences (velocity array) plot (1:449, output,'LineWidth',3) 40 06 0.1 0.15 Optional: what quantity do you think we are measuring when differentiating velocity over time -ie what does the value output keep a track of, in this example

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!