TRUE lab utilizes various kinds of physiological data to analyze driver’s fatigue or stress. Measuring physiological signals can show overall patterns that are not intrinsic to the data. These trends can sometimes hinder the data analysis and must be removed. Consider two electrocardiogram (ECG) signals with different trends. ECG signals are sensitive to disturbances such as power source interference. In order to solve this problem, we can use curve fitting method. Curve fitting is the process of constructing a curve, or mathematical function, that has the best fit to a series of data points, possibly subject to constrains. Curve fitting can involve either interpolation, where an exact fit to the data is required, or smoothing. By using ‘polyfit’ and ‘polyval’ function in Matlab, the trend can be removed. Polyfit computes a least squares polynomial for a given set of data. Polyfit generates the coefficients of the polynomial, which can be used to model a curve to fit the data. Polyval evaluates a polynomial for a given set of x values. Therefore, polyval generates a curve to fit the data based on the coefficients found using polyfit.