subject

1. Create a function called calcPolyFit. It should take the following two arguments, in this order. a text string and an array. The text string will contain the name of a data file. The array will contain integers representing the degrees of polynomials to be fitted to the data. The function should return two values, in this order: an integer value indicating if the function was successful (1) or unsuccessful (0) and an array containing the coefficients of the polynomial fit for a polynomial whose degree is equal to the last value in the input array. The function should read the (x, y) data from the specified data file and the use the polyfit function to fit polynomials. For example, this function call: [a, b] calcPolyFit('data. txt', [135]) should read data from the file "data. txt" and compute polynomial fits of degrees 1, 3, and 5. If the function call is successful, a should equal 1, and otherwise it should equal 0. In this example, if the function call is successful, b should contain the coefficients of a polynomial fit of degree 5. If the function call is unsuccessful, b should equal an empty array(1). 2. The data files will be text files in the following format: yi Y2 Y3 X X2 X3 . Yn Хо 3. The function should create a plot of the data points and the polynomial fits. The data points should be plotted with plus sign markers ("+"). The polynomial fits should be plotted as continuous lines. Your plots should have a legend. In the legend, the data points from the input file should be labeled as "data". The polynomial fits should be labeled according to their degree, such as "Degree=3". Your plots should have titles and axis labels. 4. The function shall perform all steps needed to construct the plots. No user interactive formatting shall be used. 5. The function shall be robust in that it includes error-checking and verification of user inputs. For example, if the data file does not exist or the input arguments are invalid, your function should return a success value of 0

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 19:10
How might the success of your campaign be affected if you haven’t carefully completed all field data or if you accidentally insert the wrong merge field in the document?
Answers: 1
question
Computers and Technology, 22.06.2019 21:00
Describir textbook icon_person mira los dibujos y describe lo que está pasando. usa los verbos de la lista.
Answers: 1
question
Computers and Technology, 22.06.2019 22:20
Pp 4.1 design and implement a class called sphere that contains instance data that represents the sphere’s diameter. define the sphere constructor to accept and initialize the diameter and include getter and setter methods for the diameter. include methods that calculate and return the volume and surface area of the sphere (see pp 3.5 for the formulas). include a tostring method that returns a one-line description of the sphere. create a driver class called multisphere, whose main method instantiates and updates several sphere objects.
Answers: 1
question
Computers and Technology, 23.06.2019 18:40
How does is make you feel when you're kind to others? what are some opportunities in your life to be more kind to your friends and loved ones? imagine a world where kindness has be outlawed. how would people act differently? would your day-to-day life change significantly? why or why not?
Answers: 2
You know the right answer?
1. Create a function called calcPolyFit. It should take the following two arguments, in this order....
Questions
question
Mathematics, 11.09.2021 04:40
question
Mathematics, 11.09.2021 04:40
question
Mathematics, 11.09.2021 04:40
question
Mathematics, 11.09.2021 04:40