Question: Question 1 . Write two Matlab functions S 1 3 ( F , h ) and S 3 8 ( F , h ) that
Question Write two Matlab functions and that calculate the approximate integral given the vector of values and the uniform spacing of nodes As the name suggeste, the first should use the Simpson composite rule and the second the Simpson composite rule. Depending on the number of sampled points the length of the vector it may not be possible to evenly divide the integration interval. For example, if then there are segments and you can fit exactly two subintervals using the rule, but only one subinterval with plus an extra segment. In the latter case, zeropads the input vector until you have the right number of point. In the example above, you will need to add two more zeros at the end of Similarly, if you have then you have subintervals with segments each, so the method is fine, but you will need to zeropad with one extra point to fit subintervals for the 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 zeropad.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
