Question

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)

Problem 3 The following table gives the drying time T of a particular paint as a function of the amount A of additive. A (oz): 2 T (min): 130 115110 9o 89 3995 (a) Write a program to compute the first-degree and third-degree polynomials that fit the data, displaying the polynomial coeficients. Remember to include text to describe the displayed coefficients. (b) compute and display tincluding what the information isi the sum of the squares for each curvt (c) Plot the data and thertwo curve fits on a single plot, for 101 values ofA in the range osAS9. 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 1 and 3rd degree polynomials? Does this make sense? (Answer as comments in the .m file

0 0
Add a comment Improve this question Transcribed image text
Answer #1

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:

octave:3> source (polynomial.m) First-degree polynomial coefficient: 0.69697 108.43636 Third-degree polynomial coefficient:

The list of values are the sum of square values:

1.9800e+00 2.0700e+00 2. 1600е+00 2. 2500е+00 2. 3400е+00 2. 4300е+00 2. 5200е+00 2. 6100е+00 2. 7000е+00 2. 7900е+00 2. 8800

4. 7700е+00 4. 8600е+00 4. 9500е+00 5. 1300е+00 5. 2200е+00 5. 3100е+00 5. 4900е+00 5. 5800е+00 5. 6700е+00 5. 7600е+00 5. 85

7.3800e+00 7. 4700е+00 7.5600e+00 7. 6500е+00 7. 7400е+00 7. 8300е+00 7. 9200е+00 8. 0100е+00 8.1000e+00 8.1900e +00 8. 2800е

Below is the output of the plot of the curves for first degree and third degree polynomials:

140 Data Linear Fit 13 120 -110 100 90 80 4 ti 10 A(oz) OZ

Add a comment
Know the answer?
Add Answer to:
Matlab: a) Write a program to compute the first-degree and third-degree polynomials that fit the data,...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT