Question: Problem 1 Spline interpolation (25 points) Download the starter code Hw6p1.m from CANVAS Files section folder HW Problems to your computer, and rename it as
Problem 1 Spline interpolation (25 points) Download the starter code Hw6p1.m from CANVAS Files section folder "HW Problems" to your computer, and rename it as Yourlastname YourfirstnameHW6p1.m. The starter code uses data from the U.S. Standard Atmosphere 1976 model to plot how the average temperature in degree Celcius) varies with altitude (in Km) above the Earth's sea level. Write your code between lines 27 and 30 of the starter file to compute and plot the linear spline (in red solid line), the quadratic spline (green dash dotted line), the cubic spline (blue dashed line) interpolants together with the datapoints in grey circles (already plotted). In other words, running your code should generate all the plots in the same figure To do the spline interpolation, you don't need to code the square linear systems from scratch. Instead, look up MATLAB inbuilt Lommands spapi and fnval in MATLAB documentation. For computing degree d spline, the first argument of spapi must be d+1. So, spapi (2,...,...) for linear spline, etc. The second argument of fnval must be h (defined in line 10) for linear spline, and h query (defined in line 24) for higher degree splines. Problem 1 Spline interpolation (25 points) Download the starter code Hw6p1.m from CANVAS Files section folder "HW Problems" to your computer, and rename it as Yourlastname YourfirstnameHW6p1.m. The starter code uses data from the U.S. Standard Atmosphere 1976 model to plot how the average temperature in degree Celcius) varies with altitude (in Km) above the Earth's sea level. Write your code between lines 27 and 30 of the starter file to compute and plot the linear spline (in red solid line), the quadratic spline (green dash dotted line), the cubic spline (blue dashed line) interpolants together with the datapoints in grey circles (already plotted). In other words, running your code should generate all the plots in the same figure To do the spline interpolation, you don't need to code the square linear systems from scratch. Instead, look up MATLAB inbuilt Lommands spapi and fnval in MATLAB documentation. For computing degree d spline, the first argument of spapi must be d+1. So, spapi (2,...,...) for linear spline, etc. The second argument of fnval must be h (defined in line 10) for linear spline, and h query (defined in line 24) for higher degree splines
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
