Question: Question 1 . Write two Matlab functions S 1 3 ( F , h ) and S 3 8 ( F , h ) that

Question 1. Write two Matlab functions S13(F,h) and S38(F,h) that calculate the approximate integral given the vector of values F and the uniform spacing of nodes h. As the name suggeste, the first should use the Simpson composite 13 rule and the second the Simpson composite 38 rule. Depending on the number of sampled points (the length N of the vector F) it may not be possible to evenly divide the integration interval. For example, if N=5, then there are 4 segments and you can fit exactly two subintervals using the 13 rule, but only one subinterval with 38 plus an extra segment. In the latter case, zero-pads the input vector F until you have the right number of point. In the example above, you will need to add two more zeros at the end of F. Similarly, if you have N=10, then you have 3 subintervals with 3 segments each, so the 38 method is fine, but you will need to zero-pad F with one extra point to fit 5 subintervals for the 13 method. In your code, do NOT use for or while loops. Use instead slicing and the builtin Matlab function sum if you need to add the elements of an array. It is ok to use a for or while loop to zero-pad.
 Question 1. Write two Matlab functions S13(F,h) and S38(F,h) that calculate

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!