Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Programming Problem: 2. [42 points] In this problem, we write a program to estimate the parameters for an unknown polynomial using the polyfit] function of

image text in transcribed
Programming Problem: 2. [42 points] In this problem, we write a program to estimate the parameters for an unknown polynomial using the polyfit] function of the numpy package. 1) Please plot the noisy data and the polynomial you found (in the same figure). You can use any value of m selected from 2,3,4,5,6. 2) Plot MSE versus order m, for m=1,2,3,4,5,6,7,8 respectively. Identify the best choice of m. 3) Change variable noise,scole to 200,300,400,600,800,1000 respectively, te-fun the algorithm and plot the polynomials with the m found in 2). Dircuss the impact of noise scale to the accuracy of the returned parameters. (You need to plot a figure like in 1) for EACH choice of noise scale.] 4) Change variable number_of somples to 40,30,20,10 respectively, te.ran the algorithm and olot the polynomials with the m found in 2). Discuss the impact of the number of samples to the accuracy of the returned parameters. (You need to plot a figure like in 1) for EACH choice of number_of_samples.] Please vie the following code at the beginning of vour program to generate the data. Simulated data is given as follows in Python: import matplotlib.pyplot as plt pit.style ure('seaborn.whitegrid') import numpy as np noise_scale =100 number_of samples =50 x=30 (nprandom.rand(number_of_samples, 1) - 0.5) y=5x+15x2+2x3+ noise sicale* np random.randn(number_of_samples, 1) pleplot(x,y, ro')

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Programming The Perl DBI Database Programming With Perl

Authors: Tim Bunce, Alligator Descartes

1st Edition

1565926994, 978-1565926998

More Books

Students also viewed these Databases questions