Question: Fit the following model in Python: Y = a+bx+ced x Use a numpy or scipy function, considering the following steps: a) c) Obtain 100

Fit the following model in Python: Y = a+bx+ced x Use a


Fit the following model in Python: Y = a+bx+ced x Use a numpy or scipy function, considering the following steps: a) c) Obtain 100 pairs of points (x,y) from the above model using the parameters: a=2, b=3, c=-1 and d=1.2, with x = [-3,3]. Obtain z by adding Gaussian noise with standard deviation =0.2 to the y's calculated above, obtain, z=y+ where n is a normal random variable with standard deviation 0.2. Show the points (x,y) and (x,z) above in the same figure. For the points (x,y) use two styles: line and points. Note: note that to display the 'line' style the x's must be ordered from least to older. Write a function in Python that receives as parameters, the data (X,Z) and return the estimated parameters of the model. Show in the same figure: the original model and the estimated model, for x [-3,3].

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Algorithm of the code 1 Import necessary libraries Import numpy for numerical operations matplotlibpyplot for plotting and scipyoptimizecurvefit for fitting the model to data 2 Define parameters Set t... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!