Answered step by step
Verified Expert Solution
Question
1 Approved Answer
NEED PYTHON Q4: Polynomial Fit - 20 pts The file associated with this question is polyfit.py. Part A. (6 points) Using Numpy create the (x,y)
NEED PYTHON
Q4: Polynomial Fit - 20 pts The file associated with this question is polyfit.py. Part A. (6 points) Using Numpy create the (x,y) data pairs as follows: x is a numpy array sampling the range 0 to 3 with 100 points (0 & 3 inclusive) y is a numpy array with the values given by the following eqn. y = (x - 1)* +0.3 (x - 2) Add noise to y values by using random numbers. The random numbers should be uniform in the range [-1.0,1.0] Part B. (3 points) Plot the (x,y) data on a scatter plot. Part C. (6 points) Fit polynomials of order 1, 3, and 5 to the (x,y) data. Part D. (5 points) Plot the polynomial fits on the same figure as line plots. Your final graph should look like this: (The legends are shown to clarify the expected output. But they are not required.) 15.0 y=y(x) Poly. Ord. 1 Poly. Ord. 3 Poly. Ord. 5 12.5 10.0 7.5 5.0 2.5 0.0 -2.5 0.0 0.5 1.0 1.5 2.0 2.5 3.0Step 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