How to formulate and use non linier curve-fitting

조회 수: 1 (최근 30일)
Skydriver
Skydriver 2019년 12월 2일
댓글: 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

채택된 답변

Star Strider
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
Skydriver
Skydriver 2019년 12월 2일
Thank you, I will try to a test with several models as your suggestion
Star Strider
Star Strider 2019년 12월 2일
As always, my pleasure!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Linear and Nonlinear Regression에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by