Matlab:
a) Write a program to compute the first-degree and third-degree polynomials that fit the data, displaying the polynomial coefficients. Remember to include text to describe the displayed coefficients.
(b) Compute and display (including what the information is) the sum of the squares for each curve fit.
(c) Plot the data and the two curve fits on a single plot, for 101 values of A in the range 0 ? A ? 9. Choose different line styles for each curve and generate a legend.
(d) Which curve fits better with the original data? What happens with the sum of squares between the 1st and 3rd degree polynomials? Does this make sense? (Answer as comments in the .m file)
Answer:
Please find below the code for the above requirement:
A = [0,1,2,3,4,5,6,7,8,9];
A1 = linspace(0,9,101);
T = [130,115,110,90,89,89,95,100,110,125];
poly1 = polyval(polyfit(A,T,1),A1);
disp(' =First-degree polynomial coefficient: ');
disp(polyfit(A,T,1));
poly3 = polyval(polyfit(A,T,3),A1);
disp("Third-degree polynomial coefficient:")
disp(polyfit(A,T,3))
func = @(x,A)x(1)*exp(x(2)*A);
lsqcurvefit(func,A1,A,T)
plot(A,T,'o',A1,poly1,A1,poly3)
xlabel('A(oz)')
ylabel('T')
legend('Data','Linear Fit','Cubic Fit') % linear is for first order
and cubic is for third order
PFB snapshot of the output:
The list of values are the sum of square values:
Below is the output of the plot of the curves for first degree and third degree polynomials:
Matlab: a) Write a program to compute the first-degree and third-degree polynomials that fit the data,...
2. The followving data give the drying time T of a certain pauin n t a certain additive A. Find the first, second, third, and fourth-degree polynomials that fit the data and plot each polynomial with the data. Set limits O and 10 on the x-axis and a function of the amount 10 on the x-axis and limits 0 and 150 on the y-axis. Determine the quality of the curve fit for each by computing J Note: You have to...
please solve using matlab 4. Nonlinear Regression Fit the below data with the following curve-fit equation y bi (ebr + 2 1.0000 1.5431 3.7622 10.0677 27.3082 Define a function of the sum of squared residuals (fSSR) as a function of the regression coefficients, b's. Minimize the fSSR function and determine the regression coefficients. Guess what would be the built-in math function to generate the original data? Plot the function in the existing figure with a smooth dashed line, calculate the...
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...
MATLAB Code for question (2) 1) Use the Matlab function polyfit to curve fit the saturation pressure versus temperature data along the vaporization line for water in the table below with a polynomial of degree n. The Matlab function polyval may be used to evaluate the polynomial at any point. Compare the saturation pressure as calculated by the polynomial with the data given in the table and observe what happens as the degree of the polynomial n is increased. Tabulate...
In cell C6, insert a Scatter Chart for the Returns Completed versus Return Price data from the Data worksheet. You may be used to seeing Price placed on the Y-axis from other economics courses, but in this problem we are using price as the independent variable. Inserting Chart Select the Scatter chart from the provided chart options in the Charts group of the Insert tab of the Ribbon. Selecting Data Series Then choose Select Data in the Design tab on...