close all; clear; clc; set (groot, 'defaultAxesTickLabe Unterpreter', 'latex'); set (groot, 'defaulttextinterpreter', 'latex'); set(groot, 'defaultLegend Interpreter latex'); 1 n = 5:7; 2 3 - 4 - 5 6 7 - 8 9 10 11 tid 12 13 - 14 - ca 15 - CC = {'r','9', '6'}; El for k=1: length(n) x = linspace(-1,1,n())'; y = 1./(1 + 25*x.^2); plot(x,y,'o', 'MarkerSize', 12, 'MarkerEdgeColor', 'k', 'MarkerFaceColor',cc- set (gca, 'FontSize',30) xlabel('$X$', 'FontSize ,25); ylabel('$y$', 'FontSize',25, 'rotation',0); hold on 16 17 .. 18 19 20 21 22 23 24 25 26 27 28 29 complete the following lines * X = ; the coefficient matrix C=;% the coefficient vector xnew = linspace(-1,1,580); evaluate the interpolated polynomial at xnew ynew = polyval(flipud(c), xnew); plot(xnew, ynew,'color',cc{k}, 'LineWidth', 2) end Problem 1 Polynomial interpolation (25 points) Download the starter code HW5p1.m from CANVAS Files section folder "HW Problems" to your computer, and rename it as Yourlastname YourfirstnameHW5p1.m. This homework problem only requires you to complete two lines of this starter code as follows. For each n 5, 6, 7, the starter code generates n uniformly spaced data points in the interval [-1, 1) and plots them as different colored circular markers (red for n = 5, green for n = 6, and blue for n = 7). Watch out for overlapping markers. For each n, you need to compute and plot an interpolating polynomial in the corresponding colored lineplot. To do so, uncomment and complete the lines 20 and 21 in the starter code. Then uncomment lines 23, 25, 27. Other than completing the lines 20-21, and uncommenting lines 23, 25, 27, you are NOT allowed to change or add anything else in the starter code. You should be able to verify the correctness of your lines 20-21 by examining the plot that the completed code generates (and reviewing the concepts learnt in Lec. 9). close all; clear; clc; 2 3- 4- 5 set (groot, 'defaultAxesTickLabe Interpreter', 'latex'); set (groot, 'defaulttextinterpreter', 'latex'); set(groot, 'defaultLegendInterpreter latex'); D n = 5:7; - CC = {'r','g', '6'}; 7- 8 9 10 11 i 12 13 - 14 al 15 16 17 . for k=1: length(n) x = linspace(-1,1,n(k))'; y = 1./(1 + 25*x.^2); plot(x,y,'o', 'MarkerSize', 12, 'MarkerEdgeColor', 'k', 'MarkerFaceColor", cc{ set(gca, 'FontSize',30) xlabel('5x$', 'FontSize ,25); ylabel('$y$', 'FontSize', 25, 'rotation',0); hold on 18 19 20 21 22 23 complete the following lines % X = ; * the coefficient matrix WC = ; * the coefficient vector 24 % xnew = linspace(-1,1,500); * evaluate the interpolated polynomial at xnew * ynew = polyval(flipudic),xnew); 25 26 27 28 29 * plot(xnew, ynew, 'color',cc{k}, 'LineWidth', 2) end