Please find the required MATLAB script for part (C) :
%==================================================================================
clear all;clc;format short
x = [1750,1800,1850,1900,1950,1990,2000,2009];
y = [791,980,1260,1650,2520,5270,6060,6800];
% Linear fit
p = polyfit(x,y,1); % Order 1 polynomial is essentially a
line
y_lin_fit = polyval(p,x);
lin_1975 = polyval(p,1975);
% spline fit
y_spline_fit = interp1(x,y,x,'spline');
spline_1975 = interp1(x,y,1975,'spline');
fprintf('Population in 1975:\n1) by Linear fit: %f million, 2) by Spline fit: %f million\n',lin_1975,spline_1975);
figure
scatter(x,y)
hold on
plot(x,y_lin_fit,'-r')
hold on
plot(x,y_spline_fit,'--g')
legend('Original Data','Linear fit','Spline fit')
grid on
xlabel('Year')
ylabel('Population (million)')
%================================================================================
Output:
Population in 1975:
1) by Linear fit: 4717.218881 million, 2) by Spline fit:
4098.602853 million
In case of any clarification required, please comment!
******** PLEASE THUMBS UP!!!!!!! ********
I want -C parts- using matlab 2. The population of the world for selected years from...
I need help with parts A B D E and F. Please show hand work for solving A and B while D and E should be matlab codes. How do i pick the right graph for part F? 5 2 4 6 Linear spline: s fi+ (x-x) 2) Given the points 40 78 125 256 348 425 X1-x a) Write the correct linear spline equation to interpolate for x 4.72, simplifying where appropriate to get to the slope-intercept form. (4...
A wind tunnel test conducted on an airfoil section yielded the following data between the lift coefficient (CL) and the angle of attack (?): 12 1.40 16 1.71 20 1.38 de CL 0.11 0.55 0.95 You are required to develop a suitable polynomial relationship between ? and CL and fit a curve to the data points by the least-squares method using (a) hand calculations and (b) Matlab programming Hint: A quadratic equation (parabola) y(x)-aa,x +a x' can be used in...