(Solved): Problem 6. Write down Matlab codes. You can use Matlab if you feel the need (20 points) (7.1) Write ...
Problem 6. Write down Matlab codes. You can use Matlab if you feel the need (20 points) (7.1) Write a Matlab code that creates \( A \) which is a series of the numbers, \( \{-5,-10,-15 \), \( -95,-100\} \) (7.2) Write a Matlab code that calculate \( \mathrm{P} \) that multiplies all numbers of A. You must write a code using for-loop.
Problem 7. You are programming the MATLAB to find out the area below \( y=x^{3}+x \) where \( x \) ranges from 0 to 1 . You are estimating the area under the curve with the 10 rectangles whose width is the identical to 0.1. (20 Points) (a) Write the equation to calculate the height of each rectangles ( \( h \) where \( i=1,2, \ldots 10 \) is the index of each rectangle). (b) Write the equation to calculate the area A of the i-th rectangle.
(c) Write a MATLAB code to approximate the area with the sum of 10 rectangles (Al) using the for-loop. (d) Write a MATLAB code to approximate the area with the sum of 100 rectangles (A) using the for-toop. (e) Which estimate (c or d) will be closer to the true value of the area under the curve?