# How to formulate and use non linier curve-fitting

1 ビュー (過去 30 日間)
Akhmad Muktaf 2019 年 12 月 2 日
Commented: Star Strider 2019 年 12 月 2 日
I have a dependent variabke Xd and three independent variabel X1, X2 and depth.
I want to formulate new equation using exponential function. I assume the equation is like this Xd = exp(b1 + b2* -dpth *(X1/X2)
Is there any one can help

#### 0 件のコメント

サインイン to comment.

### 採用された回答

Star Strider 2019 年 12 月 2 日
Try this:
D = dlmread('Example.txt', '\t', 1, 0);
objfcn = @(b,x) exp(b(1) - b(2).*x(:,1).*x(:,2)./x(:,3)); % Objective Function
[B,rnrm] = fminsearch(@(b) norm(D(:,4) - objfcn(b,D(:,1:3))), rand(2,1)) % Estimate PArameters
Xdfit = objfcn(B,D(:,1:3)); % Results
Compare = [D(:,4), Xdfit, D(:,4)-Xdfit]; % Results
figure
plot(D(:,4), Xdfit, '-*')
grid
The independent variable matrix is created as:
[Depth X1 X2] = D(:,1:3)
with ‘Xd’ being ‘D(::,4)’.
The plot is of the actual ‘Xd’ and ‘Xdfit’, the modeled ‘Xd’.

#### 8 件のコメント

Star Strider 2019 年 12 月 2 日
The result will be different if you change the regression model. The new model is coded correctly, so you only need to interpret the results. Choose a model that most closely represents the process that created your data, or that most closely represents the physics of the system you are estimating. It is common to create and test several models (based on the appropriate assumptions about the data) to determine which model most closely reproduces the data.
Akhmad Muktaf 2019 年 12 月 2 日
Thank you, I will try to a test with several models as your suggestion
Star Strider 2019 年 12 月 2 日
As always, my pleasure!

サインイン to comment.