文档介绍:MATLAB 线性拟合详解
公式是:ln(x)=A+B/T+Cln(T)
以下是四组数据,,每组求一个,A,B,C. T 就是 T/K 下的数据。X 就是 Xexp
T/K c/g*kg-1 水 Xexp
293
298
303
308
313
T/K c/g*kg-1 水 Xexp
293
298
303
308
313
T/K c/g*kg-1 水 Xexp
293
298
303
308
313
T/K c/g*kg-1 水 Xexp
293
298
303
308
313
1. Copy the data into some file named
Fig. 1
2. Open Matlab, load the into Matlab workspace
Fig. 2
Fig. 3
Fig. 4
Fig. 5
3. Generate T and x vector:
Enter T= test1(:, 1), x= test1(:, 3) in mand window
Fig. 6
4. Enter cftool in mand window:
cftool
Fig. 7
Choose Data…and choose X Data: x, Y Data: T
Fig. 8
Fig. 9
Then Click “Create data set”
Fig. 10
Close it
Choose “Fitting…”(see the second red box in Fig. 8)
Fig. 11
Click “New Fit”
Choose “Typeof fit”= “Custom Equations”
Fig. 12
Click “New”
Fig. 13
Choose
“ Gen
eral Equations”
Fig. 14
Enter the equation you want to fit:
Box 1: T
Box 2: log(x) %% in Matlab log(x) is the ln(x) in traditional math (log(x)=ln(x),
log10(x)=lg(x))
Box 4: The data here is auto create by Matlab (default), you can ignore it for
the present
BTW, you can change the equation from log(x)= A+B/T+C*log(T) to x=
exp(A+B/T+C*log(T)) or something like this, but perhaps it will not affect the
fitting results.
Fig. 15
Click “OK”
Back to the Fitting window, Click “Apply”