Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Problem 4 (programming): Create a MATLAB function named my cubic spline.m to perform interpolation using cubic spline method with clamped end-conditions. Download the template

image text in transcribed

Problem 4 (programming): Create a MATLAB function named my cubic spline.m to perform interpolation using cubic spline method with clamped end-conditions. Download the template for the function from the homework 6 folder in CANVAS. The function takes in the data given at the knots, xi and yi, the first derivative at the first knot, sprime x1, the first derivative at the last knot, sprime xn, as well as the target x value, xtarget The function returns the interpolated value ytarget Here, xi and yi are vectors while sprime x1, sprime xn, xtarget and ytarget are scalars. You are not required to follow the template; you can construct the function in your way. . . Use function my cubic spline.m and the seawater temperature data in table 1 to per- form the following exercises. Also, set the first derivative of the spline at the knot z = - 12m to be equal to 0.0C m- 1 and the first derivative at the knot z = - 330m to be equal to 0.0082C m 1. (a) Estimate the temperature at depth z = -150 m using all knots. Put the answer in p4a . . (b) Create a vector depth = [-330:2:-12] Estimate the temperature for every element in vector depth and store them in vector temperature Use all knots to perform the interpolation. Make a figure 4, e.g. figure(4) Use a solid line to plot temperature versus depth with temperature on the x-axis and depth on the y-axis. Also, use symbols to plot all knots on table 1. Remember to give the figure a legend and a title and label the axes. Set p4b = 'See figure 4. (c) Comment on the difference between the cubic spline interpolation result seen here and the Lagrange interpolation result obtained in problem 5 of homework 5. Give the answer as p4c =

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Fundamentals of Ethics for Scientists and Engineers

Authors: Edmund G. Seebauer, Robert L. Barry

1st Edition

9780195698480, 195134885, 195698487, 978-0195134889

More Books

Students also viewed these Mechanical Engineering questions

Question

Identify the parties to a trust.

Answered: 1 week ago

Question

Define the probate process.

Answered: 1 week ago