Presentation is loading. Please wait.

Presentation is loading. Please wait.

EEE 244-7: Curve Fitting.

Similar presentations


Presentation on theme: "EEE 244-7: Curve Fitting."— Presentation transcript:

1 EEE 244-7: Curve Fitting

2 Need for curve fitting Engineering projects involve collection of data, such as line voltage, cellular signal power Curve fitting provides a smooth fit to the data by an approximating function Data can be approximated by polynomial functions and splines

3 Polynomial functions Approximating curve yc represented by an mth order polynomial: Polynomial coefficients c1, c2 ……cm+1 values are obtained from data points Linear or straight line fit: m = 1 Nonlinear fit : m > 1

4 Matlab functions for polynomial curve fitting
The coefficient matrix C = [c1, c2 ……cm+1] can be calculated by the Matlab polyfit command: C = polyfit(x,y,m) where [x y] is the data set m is the order of the polynomial The command polyval (C,x0) gives the value of the polynomial at the point x0

5 Example of polynomial curve fitting

6 Cubic splines Polynomial approximation can produce points that are not allowed For example, if the data is for absolute voltage, polynomial can have negative and positive values Splines are piecewise approximating cubic functions that can overcome polynomial problems

7 Matlab command for cubic splines
The Matlab command interp1 creates cubic spline set Given the data set [x y], the command: yi = interp1(x,y,xi, spline) yields the value of the function at the point xi The function can be obtained by giving a range of [xi yi[

8 Example of curve fitting
Given the following data set: Write a Matlab program to fit a curve using: Polynomial function of order 3 Cubic spline fit In both cases, sketch the approximating function


Download ppt "EEE 244-7: Curve Fitting."

Similar presentations


Ads by Google