Explore BrainMass

Explore BrainMass

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

    This content was COPIED from BrainMass.com - View the original, and get the already-completed solution here!

    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.

    © BrainMass Inc. brainmass.com February 24, 2021, 2:34 pm ad1c9bdddf


    Solution Summary

    Matlab is used to evaluate a least-squares problem involving a planetary orbit. The solution is detailed and well presented. The solution was given a rating of "5" by the student who originally posted the question.