Starting from:

$24.99

EE25745-1 Exercise 5 Solution



• Reports should include answers to the questions, diagrams, charts and explanation of your methods.
• MATLAB codes should be attached to your reports. Codes are also considered to be well-written with appropriate comments.
• It is suggested to use MATLAB Live Script for preparing your reports more conveniently.
• Reports should be uploaded to courseware.
• Naming Format: HW5_StudentNumber


1.
(a) Write a MATLAB function for computing the Newton polynomial interpolant.
(b) Write a MATLAB function which uses cubic spline method for interpolating data.
(c) Use these functions for interpolating f(x) = log2 𝑥 over the domain [1,4] for h=1, h=0.5.
(d) Use these polynomials for approximating f(x) in 𝑥 = 0.5,𝑥 = 5.




2. Interpolating the data points

t 0 1 4 9 16 25 36 49 64
y 0 1 2 3 4 5 6 7 8
Should give an approximation to the square root function.
(a) Compute the polynomial of degree eight that interpolates these nine data points. Plot the resulting polynomial as well as the corresponding values given by the built-in sqrt function over the domain [0,64].
(b) Use a cubic spline routine to interpolate the same data and again plot the resulting curve along with the built-in sqrt function.
(c) Which of the two interpolants is more accurate over most of the domain?
(d) Which of the two interpolants is more accurate between 0 and 1?











3. A planet follows an elliptical orbit, which can be represented in a Cartesian (x,y) coordinate system by the equation
𝑎𝑦2 + 𝑏𝑥𝑦 + 𝑐𝑥 + 𝑑𝑦 + 𝑒 = 𝑥2
(a) Design a routine for linear least squares to determine the orbital parameters 𝑎, 𝑏, 𝑐, 𝑑, 𝑒, given the following observations of the planet’s position:

x 1.02 0.95 0.87 0.77 0.67 0.56 0.44 0.30 0.16 0.01
y 0.39 0.32 0.27 0.22 0.18 0.15 0.13 0.12 0.13 0.15
In addition to printing the values for the orbital parameters, plot the resulting orbit and the given data points in the (x,y) plane.

(b) This least square problem is nearly rank deficient. To see what effect this has on the solution, perturb the input data slightly by adding to each coordinate of each data point a random number uniformly distributed on the interval [-0.005,0.005] and solve the least square problem with perturbed data. Compare the new values for the parameters with those previously computed. What effect does this difference have on the plot of the orbit? Can you explain this behavior?

(c) Solve the same least square problem again, for both the original and the perturbed data, this time using a routine specifically designed to deal with rank deficiency by using pivoting. Compare the behavior of the two solutions for the original and the perturbed data.
Which solution would you regard as better: one that fits the data more closely, or one that is less sensitive to small perturbations in the data?
Why?



More products