Question

In: Computer Science

You are asked to use MATLAB tools to curve fit the data provided as X and...

  1. You are asked to use MATLAB tools to curve fit the data provided as X and Y vectors.

X = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]

Y = [-1.5, 16, 44, 90, 141, 207, 292, 398.4, 522, 670]

  1. (5 points) Use MATLAB command polyfit to fit the provided data X and Y with a 1st order polynomial function (linear function). Write down the equation y1 = f(x).

  1. (5 points) Use MATLAB command polyfit to fit the provided data X and Y with a 2nd order polynomial function. Write down the equation y2 = f(x).

  1. (5 points) Use MATLAB command polyval to evaluate the polynomial function obtained from a) and b) for the given values X. Make them Y1 and Y2, respectively.

  1. (10 points) Use MATLAB commands to plot the original data Y, and the curve fitted data Y1, and Y2, on the same figure. There should be three lines on the plot (one for original data points, and two for curve fitted data points). Please include title, axis labels, and legends in the plot.

Solutions

Expert Solution

%Matalb Code for given question
X=[1,2,3,4,5,6,7,8,9,10]
Y=[-1.5,16,44,90,141,207,292,398.4,522,670]
syms x
p=polyfit(X,Y,1) % This fit data X,Y eith 1st order polynomial
y1=p(1)+p(2)*x   %This is linear function y1=f(x) 
p2=polyfit(X,Y,2)  % This fit data X,Y eith 2nd order polynomial
y2=p2(1)+p2(2)*x+p2(3)*x^2  %This is function y2=f(x) 
Y1=polyval(p,X) %This evaluate the polynomial function obtained from(a)at X
Y2=polyval(p2,X)%This evaluate the polynomial function obtained from(a)at X
plot(X,Y,'k')  %This plot the graph of original data points X,Y
hold on
plot(X,Y1,'r')  %This plot the fitted curve obtained by linear polynomial
plot(X,Y2,'c')   %This plot the fitted curve obtained by quadratic polynomial
title('Graph of data points')
xlabel('X-Axis')
ylabel('Y-Axis')
legend(' Original data curve',' linear Y1','Quadratic Y2')

Output


Related Solutions

For the data below graph and determine the fit you should use based on the information...
For the data below graph and determine the fit you should use based on the information available. Also try to think about any natural system that might use this type of fit (use SciDavis). Let the horizontal axis represent time in seconds. Choose a physical quantity for y data. Paste graph below and list the values of fitting parameters, along with their uncertainties. Watch significant figures and don’t forget the units for each parameter. X Y 1 1.82 2 2.36...
You have been provided with accounting research tools. Use them to answer the following multiple choice...
You have been provided with accounting research tools. Use them to answer the following multiple choice questions. After you make your choice, tell me what theory you are basing your answer on, or what part of the codification applies to the question 6 Hudson Corp. operates several factories that manufacture medical equipment. The factories have a historical cost of $200 million. Near the end of the company’s fiscal year, a change in business climate related to a competitor’s innovative products...
You have been provided with accounting research tools. Use them to answer the following multiple choice...
You have been provided with accounting research tools. Use them to answer the following multiple choice questions. After you make your choice, tell me what theory you are basing your answer on, or what part of the codification applies to the question. As you may have guessed, this is an open book quiz. [1] GAAP applying to earnings per share require a. Restatement of EPS data of a prior period if the earnings of the prior period have been restated....
You have been provided with accounting research tools. Use them to answer the following multiple choice...
You have been provided with accounting research tools. Use them to answer the following multiple choice questions. After you make your choice, tell me what theory you are basing your answer on, or what part of the codification applies to the question (explain). As you may have guessed, this is an open book quiz. Smith Corporation had net income for the year of $101,504 and a simple capital structure consisting of the following common shares outstanding: Months Outstanding = Number...
You have been provided with accounting research tools. Use them to answer the following multiple choice...
You have been provided with accounting research tools. Use them to answer the following multiple choice questions. After you make your choice, tell me what theory you are basing your answer on, or what part of the codification applies to the question. 2. During the year just ended, Lawrence Co. incurred $20,000 of costs to repair Machine A. These expenditures improved the quality and quantity of output but did not extend the useful life. Lawrence also spent $1,000 to replace...
you have been provided with accounting research tools. Use them to answer the following multiple choice...
you have been provided with accounting research tools. Use them to answer the following multiple choice questions. After you make your choice, tell me what theory you are basing your answer on, or what part of the codification applies to the question. As you may have guessed, this is an open book quiz. Answer Sheet 1. An entity reports the cumulative effect on earnings of prior years as an adjustment of the beginning balance of retained earnings for the first...
Identify what tools you would use, along with the testing procedures provided, to evaluate Requirement 6...
Identify what tools you would use, along with the testing procedures provided, to evaluate Requirement 6 of the PCI DSS. Make sure to identify a tool (as applicable) for testing procedure and state the tool you would use to verify compliance.
Matlab Consider f(x) = x^3 - x. Plot it. (a) Use Newton's method with p_0 =1.5...
Matlab Consider f(x) = x^3 - x. Plot it. (a) Use Newton's method with p_0 =1.5 to find an approximation to a root with tolerance TOL = 0.01. (b) Use secant method with p_0 = 0.5 , p_1 =1.5, to answer same question as (a). (c) Use Method of False position with initial approximate roots as in (b).
Search the Internet for data analytic tools and review tools for business use. Consider key features,...
Search the Internet for data analytic tools and review tools for business use. Consider key features, usefulness, and cost. Respond to the following in a minimum of 175 words: What criteria do you think are important in the selection of a data analytic tool? How could data analytic tools help small businesses? How might your selection criteria be different for a medium or large business?  
Use matlab to plot Taylor approximation for f(x) for x near 0 Given f(x) = exp(x)...
Use matlab to plot Taylor approximation for f(x) for x near 0 Given f(x) = exp(x) Use subpots to plot and its absolute and realative erros for N= 1,2,3 PLease give matlab code for Taylor and explain in detail, Thank you
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT