Question
The xy_data.txt file contains the x and y coordinates. Values in the first row correspond to the x coordinates and values in the second row
The xy_data.txt file contains the x and y coordinates. Values in the first row correspond to the x coordinates and values in the second row correspond to the y coordinates.
A. Use importdata() to import the x and y coordinates. Plot x against y as black circles.
B. Using the entire data set, fit a 7 th order polynomial to the data. Plot this data on a figure with an increased resolution of x.
C. Separate the data into two sets, when x<0 and when x>0. For data where x<0, fit a 3 rd order polynomial using polyfit. For when x>0, fit a 4 th order polynomial using polyfit. Plot this data on the same figure with an increased resolution of x for both. Ensure you label the axes and include a legend.
D. Determine the value of y at x = 0 using all 3 polynomials fitted to the data. Use fprintf to print this information. Example output is shown below. For 3 rd order, 4 th order and 7 th order polynomials, y=? y=? and y =? at x=0 respectively.
need the M-file code for this question and I will provide the data from the x-y txt in the comments.
Step 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