Why am I getting negative values from a Least squared best fit parabola for a parabola who's equation constitutes a smiling parabola?

2 views (last 30 days)
I'm in the surveying program at ferris state university and I'm doing a project for my adjustment computations course where I have have to fit a parabola to a set of data. So, ! set up the problem to solve for the scalars A,B, and C. When I plot the measured data it resembles a parabola that is U shaped but when I plot the adjusted points I end up with an n shaped parabola. I checked my values for A, B, and C and found that A is negative which shouldn't be the case I don't think. I've double checked all my data and can't find any blunders so I'm not sure what to do. here's the data that I was given:
station (x cords): 1000,1100,1200,1300,1400,1500,1600,1700,1800
elevation (y cords): 51.2,49.5,48.2,47.3,46.8,46.9,47.3,48.3,49.6
respective
Thank you for any help

Accepted Answer

Star Strider
Star Strider on 20 Nov 2015

I can’t determine the reason you’re getting the wrong parameter estimates because we don’t have your code.

This works:

sta = [1000,1100,1200,1300,1400,1500,1600,1700,1800];                           % Data: Station
ele = [51.2,49.5,48.2,47.3,46.8,46.9,47.3,48.3,49.6];                           % Data: Elevation
DM = [ones(size(sta(:)))  sta(:)  sta(:).^2];                                   % Design Matrix: [1  x  x^2]
ABC = DM\ele(:);                                                                % Estimate Parameters
fprintf(1,'\nParameters:\n\tA = %11.3E\n\tB = %11.3E\n\tC = %11.3E\n', ABC)     % Print Parameters
ele_fit = DM*ABC;                                                               % Calculate Fit
figure(1)
plot(sta, ele, 'bp')                                                            % Plot Data
hold on
plot(sta, ele_fit, '-r')                                                        % Plot Fit
hold off
grid
Parameters:
	A =   9.332E+01
	B =  -6.434E-02
	C =   2.225E-05

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!