Matlab Database > Linear Algebra > Least Squares Problems > Least-squares polynomial approximations

Matlab File(s)

Title: Least-squares polynomial approximations
Author: Alain kapitho
Institution: University of Pretoria
Description: Function least_squares(x, y, m) fits a least-squares polynomial of degree m through data points given in x-y coordinates. the output to the function is a vector c = [c0, c1, ..., cm] whose components are the coefficients of the polynomial. The function can also be used in the following sense: least_squares(x, log(x), 1) - this will linearize data that obey an exponential curve y = b*exp(a*x) and the output c = [c0, c1] = [ln b, a]. Also, least_squares(x, 1./y, 1) linearizes data that follow a model y = 1/(ax + b). In other words, various combinations can be tested to linearize data (m=1) and from the graph display, we can see which combination linarizes data best
Keywords: Least-squares, curve fitting
File Name: least_squares.m
File Size: 2 KB
File Version: 1.0
Matlab Version: 7.0 (R14)
Date: 2006-01-11
Downloads: 10417
Download File

Upload your own files today! Click here for more information.