"Application of Matlab in mathematical modeling of the" Concise notes (to be more)

Reading the read data 1.1

1. With Excel : install Excel Link

2. With Notepad :

read

When the notepad is data recorded using the load () function, the format: load ( '. Filename * * *'), the operating data stored in the notepad to form a matrix of variable named filename

When complex data structures Notepad using textread () function, rule: [A, B, C ...] = textread ( 'filename', 'format', N), A, B, C ... each column of data for the variable name to be saved, format to read format, N being the number of reads

Read more powerful notepad function: fscanf () function

write

Save as .mat format: savf file obj1, obj2 ... to the variables obj1, obj2 ... into file file (.mat format)

Saved as .txt format: fprintf: fopen () to open the file, fprintf write data, fclose to close the file

1.2 Data Approximating

Curve fitting can be fitted curve requires only a reasonable underlying trend in the data, it is not necessarily required curve through the data points

1.2.1 polynomial fitting

Determined using least squares polynomial coefficients

1. Polynomial Fitting instruction

polyfit (X, Y, N): polynomial fitting, polynomial coefficients in descending return arrangement.

polyval (P, xi): Calcd polynomial

Wherein, X, Y is the value of data points, N being fitted highest power, P is the polynomial coefficients returned, xi is the abscissa of the point required.

As shown in, (x, y) data point and the highest power as the parameter N in FIG, calculated polynomial coefficients arranged in descending P, then P and xi as a function call parameters fitted yi polyval

 

2. The polynomial fitting window graphics

First draw a scatter plot by plot, in the graphics window, click Tools -> Basic Fitting, select the appropriate option to fit.

1.2.2 designated function fitting

fittype custom fitting function, cfun = fit (x, y, f) is fit according to the fit function f custom data x, y

 

 1.2.3 Curve Fitting Toolbox

In the open command line curve fitting tool cftool

 

...

 

 

Guess you like

Origin www.cnblogs.com/laideng/p/11433582.html