Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Spline interpolation (25 points) Download the starter code Hw6p1.m from CANVAS Files section folder HW Problems to your computer, and rename it as YourlastnameyourfirstnameHW6p1.m. The

image text in transcribed
image text in transcribed
image text in transcribed
Spline interpolation (25 points) Download the starter code Hw6p1.m from CANVAS Files section folder "HW Problems" to your computer, and rename it as YourlastnameyourfirstnameHW6p1.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. Instond, look up MATLAB inbuilt commands spapi and fnval in MATLAB documentation. For computing degreed 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. Spline interpolation (25 points) Download the starter code Hw6p1.m from CANVAS Files section folder "HW Problems" to your computer, and rename it as YourlastnameyourfirstnameHW6p1.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. Instond, look up MATLAB inbuilt commands spapi and fnval in MATLAB documentation. For computing degreed 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. close all; clear; clc; set (groot, 'defaultAxestickLabelInterpreter', 'latex ); set (groot, 'defaulttextinterpreter', 'latex'); set (groot, 'defaultLegendInterpreter', 'latex'); 88 The following data are from the u.s. Standard Atmosphere 1976 model % altitude (km) above the Earth's sea level h = [0:1:10, 15:5:30, 40:10:80]'; % average temperature (degree Celcicus) above the Earth's sea level T = [15 8.5 2 -4.49 -10.98 -17.47 -23.96 -30.45 -36.94 -43.42 - 49.90 ... -56.50 -56.50 -51.60 -46.64 -22.80 -2.5 -26.13 -53.57 -74.511'; & plot the datapoints figure(1) scatter(T, h, 140, 'bo', 'MarkerEdgeColor', 'k',... MarkerFaceColor', 'k', 'MarkerFaceAlpha',0.4) hold on set (gca, 'Font Size', 30) xlabel('temperature (degree Celcius)', 'FontSize',25); ylabel('altitude (km)', 'FontSize',25); $$ compute and plot the spline interpolants h_query= linspace (min(h), max(h),200); line_color = {'r','g','b'}; line_style = {'- $ your code here to compute and plot the linear, quadratic and cubic $ splines, together with the datapoints in the same figure window you can write as many lines of code as you want in this segment legend('datapoints', 'linear spline', 'quadratic spline', 'cubic spline')

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_2

Step: 3

blur-text-image_3

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

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2014 Nancy France September 15 19 2014 Proceedings Part I Lnai 8724

Authors: Toon Calders ,Floriana Esposito ,Eyke Hullermeier ,Rosa Meo

2014th Edition

3662448475, 978-3662448472

More Books

Students also viewed these Databases questions

Question

How do we organise for international logistics?

Answered: 1 week ago