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 05:20
Write a program called assignment3 (saved in a ļ¬le assignment3.java) that computes the greatest common divisor of two given integers. one of the oldest numerical algorithms was described by the greek mathematician, euclid, in 300 b.c. it is a simple but very eā†µective algorithm that computes the greatest common divisor of two given integers. for instance, given integers 24 and 18, the greatest common divisor is 6, because 6 is the largest integer that divides evenly into both 24 and 18. we will denote the greatest common divisor of x and y as gcd(x, y). the algorithm is based on the clever idea that the gcd(x, y) = gcd(x ! y, y) if x > = y and gcd(x, y) = gcd(x, y ! x) if x < y. the algorithm consists of a series of steps (loop iterations) where the ā€œlargerā€ integer is replaced by the diā†µerence of the larger and smaller integer. this continues until the two values are equal. that is then the gcd.
Answers: 3
question
Computers and Technology, 22.06.2019 11:30
One subtask in the game is to roll the dice. explain why is roll the dice an abstraction.
Answers: 3
question
Computers and Technology, 22.06.2019 16:10
Drag each label to the correct location on the imagelist the doā€™s and donā€™ts of safeguarding your password.keep yourself loggedin when you leave your computer.donā€™t write your password down and leave it whereothers can find it.share your password with your friends.each time you visit a website,retain the cookies on your computer.use a long password with mixed characters.
Answers: 1
question
Computers and Technology, 22.06.2019 20:00
What is the worst-case complexity of the maxrepeats function? assume that the longest string in the names array is at most 25 characters wide (i.e., string comparison can be treated as o( class namecounter { private: int* counts; int nc; string* names; int nn; public: namecounter (int ncounts, int nnames); int maxrepeats() const; }; int namecounter: : maxrepeats () { int maxcount = 0; for (int i = 0; i < nc; ++i) { int count = 1; for (int j = i+1; j < nc; ++j) { if (names[i] == names[j]) ++count; } maxcount = max(count, maxcount); } return maxcount; }
Answers: 3
You know the right answer?
1. Create a function called calcPolyFit. It should take the following two arguments, in this order....
Questions
Questions on the website: 13722363