Question: Project 3, Option D MATLAB Plotting Write a MATLAB function that will take as input a set of any number of data points and will

Project 3, Option D MATLAB Plotting Write a MATLAB function that will take as input a set of any number of data points and will output a very nice plot of those points along with the least-squares line that best fits those points. The following are the specifications:

The input to the function shall be a 2 matrix where each row contains the x- and ycoordinates of each data point. (The first column has the -coordinates and the second column has the corresponding -coordinates.) Your program should work for any number of points k inputted to your function.

The output shall be to display of a single plot containing the data points and their least-squares line. No output should be displayed in the command window.

You may use any built-in functions to compute the slope and y-intercept of the leastsquares line, and to plot this line along with the given points. If you use special toolboxes that are required to be installed, note this at the beginning of your file in comments. The points and least-squares line should be easily visible on the plot. The data points shall not be connected by line segments.

There should be appropriate axes labels and a title on the plot. The equation of the least-squares line should appear somewhere appropriate on the plot.

The least-squares line shall be of one solid color and the points shall be of another color.

Your code should be efficient by using minimal memory/variables.

Comment your code briefly but thoroughly.

You may work with one partner. If you do, include in the comments a brief statement on how the work was divided and/or who was responsible for which pieces of code.

If you use ideas/code from other sources, cite them in the comments.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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 Databases Questions!