Important Note: Remember to include a published version of any Matlab ® function or script you write. Problem 1: Solving Equations (25 points) Consider a homogeneous spherical ball of radius r...

1 answer below »

Include a published version of any Matlab functionor script you write. Also, do hand calculations for solving equations, interpolation, and linear regression and least squares. (May need knowledge in Linear Analysis)




Important Note: Remember to include a published version of any Matlab ® function or script you write. Problem 1: Solving Equations (25 points) Consider a homogeneous spherical ball of radius r submerged in water—see Figure 1. The ball and water have densities ⇢b and ⇢w respectively. We wish to determine the distance d when the ball is submerged in water. At equilibrium, Archimedes’ principle states that the weight of the displaced water must be equal to the weight of the ball. (a) (6 points) Assuming the ball is submerged a distance d in the water, show that the integral giving the volume of the submerged portion of the ball is Vw = Z d 0 ⇡ ⇥ r2 � (r � x)2 ⇤ dx . (1) (b) (3 points) Evaluate (by hand) the integral of Equation (1), thereby obtaining the volume of the displaced water. (c) (6 points) Apply Archimedes’ principle to obtain the equation to be solved for the distance d . Write your answer in the form p(d) = 0 . Hint: The volume of a sphere of radius r is V = 4⇡r3/3 . For the remainder of the problem, we use the following normalized values: r = 1 and ⇢b ⇢w = 1 5 . (d) (3 points) Plot the function p(d) for d 2 [�1.5 , 3.0] . Be sure to label your figure appropriately. (e) (1 point) Suggest an integer as starting point for Newton’s method. (f) (6 points) Use the function newtons.m on Canvas with the starting point of Part (e) to obtain the depth d of the submerged ball to within 6 decimal places. AAACJXicbVDLTgJBEJzFF+IL9OhlIzHxRHaNRo9ELx4hkUcCGzI728CE2ZnNTC8JIXyBV/0Gv8abMfHkrzgLHATsZDKVqq5Od4WJ4AY979vJbW3v7O7l9wsHh0fHJ8XSadOoVDNoMCWUbofUgOASGshRQDvRQONQQCscPWZ6awzacCWfcZJAENOB5H3OKFqqHvWKZa/izcvdBP4SlMmyar2Sc9yNFEtjkMgENabjewkGU6qRMwGzQjc1kFA2ogPoWChpDCaYzjeduZeWidy+0vZJdOfsX8eUxsZM4tB2xhSHZl3LyH81MGNgaKXss+OlwvmFK02ZDZUSZm1L7N8HUy6TFEGyxZL9VL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Z8ckVuyD15IAHhBMgH+SRfzo974B66R9NQ15nl7JOSuae/dEy/Jg== Figure 1: Spherical ball submerged a depth d in water. 2 Problem 2: Interpolation (35 points) 1. (13 points) Lagrange Interpolating Polynomials Write a Matlab ® function that implements the Lagrange interpolating polynomial through the points (x1, y1), (x2, y2), . . . , (xn, yn) . • Your function should take as input two vectors x = (x1, x2, . . . , xn)T and y = (y1, y2, . . . , yn)T containing the x� and y�coordinates of the data points respectively. It must also take as input an array t = (t1, t2, . . . , tm)T at which the polynomial is to be evaluated. • Your function should output the array p = (p1, p2, . . . , pm)T containing the values of the Lagrange interpolating polynomial evaluated at the points t1, t2, . . . , tm respectively. • As a way to test your code, use 100 points to plot, on the interval [�2, 3] , the Lagrange interpolating polynomial through the points (�1, 6), (0, 4), (1, 0) , and (2, 0) . Use markers to indicate the interpolation points. You should obtain the plot of Figure 2. -2 -1.5 -1 -0.5 0 0.5 1 1.5 2 2.5 3 -2 0 2 4 6 8 10 Figure 2: Interpolating polynomial through the points (�1, 6), (0, 4), (1, 0) , and (2, 0) . 2. (22 points) Consider the function f on the interval [�1, 1] given by f(x) = 1 1 + 12x2 . (2) We wish to (graphically) investigate the interpolation error En(x) = f(x) � Pn(x) as n ! 1 , where Pn is the Lagrange interpolating polynomial through n+ 1 equidistant points (including the endpoints). (a) (3 points) Plot the function f on the interval [�1, 1] . Be sure to label your figure appropriately. 3 (b) (9 points) Use your function from Part 1 to plot (on di↵erent figures) the Lagrange interpolating polynomials P4 , P6 , P8 , P10 on the interval [�1, 1] using 1000 points. Include the function f on each figure and use markers to indicate the interpolation points. (c) (2 points) Comment on the convergence of thez interpolating polynomials Pn . We now use the following n+ 1 points to obtain the Lagrange interpolating polynomial Qn : xi = cos ✓ 2i� 1 n+ 1 · ⇡ 2 ◆ , i = 1 , 2 , . . . , n+ 1 . (3) (d) (6 points) Use your function from Part 1 to plot (on di↵erent figures) the Lagrange interpolating polynomials Q4 , Q6 , Q8 , Q10 on the interval [�1, 1] using 1000 points. Include the function f on each figure and use markers to indicate the interpolation points. (e) (2 points) Comment on the convergence of the interpolating polynomials Qn . Problem 3: Linear Regression and Least Squares (40 points) An advantage of linear regression is its applicability to data with seemingly no linear relationship. As an example, suppose we are given the data (x1, y1) , (x2, y2) , . . . , (xn, yn) and we wish to find the “best” exponential curve of the form y = B exp(Ax) (4) that approximates the data. (a) (3 points) Explain how the above nonlinear regression problem can be transformed into a linear regression problem of the form Y = ↵X + � . (5) Be sure to specify how the (unknown) parameters ↵ and � relate to A and B and how the variables X and Y relate to x and y . Hint: Consider taking the natural logarithm of both sides of Equation (4). In what follows, we consider the following (x, y) data: (�1, 6.62) , (0, 2.78) , (1, 1.51) , (2, 1.23) , (3, 0.89) . (b) (2 points) Use the result of Part (a) to obtain the (X, Y ) points corresponding to the above data set. We will call these the linearized data. (c) (3 points) Determine the inconsistent system that results from fitting the linear model of Equation (5) to the linearized data. In other words, identify the matrix A and the vector b such that Ax = b is an inconsistent system when we set x = (�, ↵)T . (d) (5 points) Deduce the normal equations for the linearized problem and solve them for the least-squares solution x⇤ using Matlab’s backslash (\) command. Remember to show your work. 4 (e) (4 points) Find (by hand) the reduced QR factorization of A . (f) (3 points) Use Matlab’s qr command to find the full QR factorization of A and verify that Q is orthogonal. (g) (6 points) Use the result of Part (f) (and Matlab’s \ command) to solve for the least squares solution x⇤ to the inconsistent system of Part (c) and provide the corresponding least-squares error. How does your answer compare to that of Part (d)? (h) (6 points) For three vectors x of your choice, compute the Euclidean norm of the residual Ax� b . How do these compare to the error computed in Part (g). Is this expected? (i) (2 points) Deduce the sought-after parameters A and B . (j) (3 points) Plot the linearized data and the best-fit linear model on the interval [�2, 4] . Label your figure appropriately. (k) (3 points) Plot the original data and the best-fit exponential curve on the interval [�2, 4] . Label your figure appropriately. 5
Answered 3 days AfterMay 06, 2021

Answer To: Important Note: Remember to include a published version of any Matlab ® function or script you...

Shreyan answered on May 08 2021
140 Votes
Solution to the MATLAB Toolbox problem
Although having the necessary software is your responsibilit
y - I wish I could help you, but I cannot.
The Symbolic Math toolbox is required for this assignment, and I cannot send you the toolbox since
it is a paid software, and also completely illegal.
There are a couple of workarounds to this:
• Install the toolboxes yourself. Either buy them or trial them or use university access ( Usually
Universities have accounts that they let their students use.). I...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here