# Least square fit of a parabola

Hi, I have attached a problem I would like help with as a picture file. It's not a difficult assignment, but I tend to make "stupid" or careless mistakes when it comes to the more "simple" things, so I would greatly appreciate your help so that I can check my work after I finish and see if I did it correctly and/or identify any mistakes I made. The first part of the picture is a thorough description of the experiment and how to do the problem, and at the bottom of the picture, you will find the data set that I am supposed to use to complete it.

Thank you very much for your help!

© BrainMass Inc. brainmass.com October 17, 2018, 1:01 pm ad1c9bdddfhttps://brainmass.com/physics/statistical-mechanics/least-square-parabola-598763

#### Solution Preview

Hello and thank you for posting your question to Brainmass.

The solution is attached below in two files. the files are identical in content, only differ in format. The first is in MS Word format, while the other is in Adobe pdf format. Therefore you can choose the format that is most suitable to you. ...

#### Solution Summary

The solutions shows in detail how to construct the system of equations for least-square fit of a quadratic polynomial.

MATLAB : Least Squares - Solving Inexactly Specified Equations in an Approximation

The solution can ONLY be accepted in Matlab. The problem is in the attachment file.

Least Square

Planetary orbit [2]. The expression z = a + bxy + cy + dx + ey + f is known

as a quadratic form. The set of points (x, y) where z = 0 is a conic section.

It can be an ellipse, a parabola, or a hyperbola, depending on the sign of

the discriminant b - 4ac. Circles and lines are special cases. The equation

z = 0 can be normalized by dividing the quadratic form by any nonzero

coefficient. For example, if f ≠ 0, we can divide all the other coefficients by

f and obtain a quadratic form with the constant term equal to one. You can

use the Matlab meshgrid and contour functions to plot conic sections. Use

meshgrid to create arrays X and Y. Evaluate the quadratic form to produce

Z. Then use contour to plot the set of points where Z is zero.

[X,Y] = meshgrid(xmin: deltax: xmax, ymin: deltay: ymax);

Z = a*X. ^2 + b*X. *Y + c*Y. ^2 + d*X + e*Y + f;

contour(X,Y,Z, [0 0])

A planet follows an elliptical orbit. Here are 10 observations of its position

in the (x; y) plane:

x = [1.02 .95 .87 .77 .67 .56 .44 .30 .16 .01]';

y = [0.39 .32 .27 .22 .18 .15 .13 .12 .13 .15]';

(a) Determine the coefficients in the quadratic form that fits this data in

the least squares sense by setting one of the coefficients equal to one and

solving a 10-by-5 overdetermined system of linear equations for the other

five coefficients. Plot the orbit with x on the x-axis and y on the y-axis.

Superimpose the ten data points on the plot.

(b) This least squares problem is nearly rank deficient. To see what effect this

has on the solution, perturb the data slightly by adding to each coordinate

of each data point a random number uniformly distributed in the interval

[-.005, .005]. Compute the new coefficients resulting from the perturbed data.

Plot the new orbit on the same plot with the old orbit. Comment on your

comparison of the sets of coefficients and the orbits.

**Please write comprehensive and interpretive descriptions and comments for code as well.

View Full Posting Details