Internet, Programming, & Power Engineering

Deriving Equation Using cftool Curve Fitting Tool of Matlab

Given a set of data points (say, X and Y), cftool toolbox of MATLAB can derive an equation that can best fit on the set of points. Type of fit can either be polynomial up to 9th degree, Fourier, exponential, and more. If the user has the general idea of the form of the curve, he/she can also supply the general equation while MATLAB will find the value of the constants.

How to use cftool?

1. In the MATLAB command prompt, create a two - n x 1 matrices, matx and maty. matx and maty should contain the x- and y-coordinates of the data points, respectively.

2. Save it as *.mat file.

3. In the command prompt, type cftool. A Curve Fitting Tool GUI similar in the figure below will appear.

4. Click “Data…” button in the Curve Fitting Tool GUI. Enter the variable containing the data points created in step 1. “X data” should contain the x-coordinates (matx) of the data points and “Y data” should contain its y-coordinates (maty). Fill in “Data set name:“. Now Click “Create data set” to load the data points. Close.

5. In Curve Fitting Tool GUI, click “Fitting…” button. Click “New fit“. Fill in “Fit Name“. Then select the “Data Set” that was earlier named in step 4. Select the “Type of Fit”, a polynomial type of fit is usually used. If a polynomial was used, select the degree of polynomial, then, click “Apply“. The generated equation should be now viewable in the “Results“. This results log usually contain the general equation, the values of the coefficients, with 95% confidence range, and the information about the goodness of the fit, which include SSE, R-square, adjusted R square and RMSE.



Filed in: Matlab

Linkblog

Search This Site

 
Web www.jcmiras.net

Sponsored Links


Translations

English flagItalian flagKorean flagChinese (Simplified) flagPortuguese flag
German flagFrench flagSpanish flagJapanese flagArabic flag
Russian flagHindi flag   
By N2H