Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Fitting with a Quadratic 10 points When working on the previous problem, you probably realized that a linear line of best fit isn't a great
Fitting with a Quadratic 10 points When working on the previous problem, you probably realized that a linear line of best fit isn't a great approximation for the data. You are given a table with the exact same data as the previous question. This time, you will use linear least squares to find the quadratic function of best fit through the data. (Note that there is no data from 2007.) Year2005 2006 2008 2009 2010 2011 2012 2013 2014 2015 Percent 12 4 63 72 78 80 83 88 84 90 Hint: Numpy has a np.linalg. 1stsq function for solving for the coefficients of the least squares problem Store the coefficients as co, c1, and c2 such that your quadratic could be written as percent co +c1'year c2*yea2. Then, plot the data points and your quadratic of best fit on the same figure. The data should be plotted using plt.scatter while the quadratic of best fit should be plotted using plt.plot. Use the same z-values when plotting the data and line of best fit. Be sure to include an appropriate title and labels on your plot. OUTPUT ce, c1, c2 Coefficients of your line Plot of data points and quadratic of best fit
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started