data fitting to equation

조회 수: 1 (최근 30일)
Sudhir Rai
Sudhir Rai 2020년 8월 20일
댓글: Walter Roberson 2023년 1월 10일
I have data for time(t) and pressure (p).
I want to fit these data to equation
I have done simple calcualtion and fittings in matlab. plese suggest how to fit data.
  댓글 수: 12
Sudhir Rai
Sudhir Rai 2023년 1월 10일
d is constant that is length of diffusion . range of C_1, c_2 :
c_1 =1e-13 to 1e-17 and c_2=1e-9 to 1e-11 approximatly.
d is ~ 1e-4
Sudhir Rai
Sudhir Rai 2023년 1월 10일
t is time which could go upto 2000 s

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

답변 (1개)

Just Manuel
Just Manuel 2021년 2월 24일
Refer to this answer from Star Strider:
You can fit any function using simple least squares regression. Just formulate your function (i guess you have already done that) in matlab, then make a cost function (least squares) and use fminsearch to optimize parameters c1 and c2
P = @(c, t) ... % your function
cost = @(c) sum((P(c,t) - p).^2);
% guess initial parameters
c_guess = [1 1];
% use fminsearch
c = fminsearch(cost, guess);
Cheers
Manuel
  댓글 수: 2
Sudhir Rai
Sudhir Rai 2023년 1월 10일
I am using for loop for my function. But I am facing problem in using loop output with fminsearch.
and it is not optimizing my parameters.
Could you help me with it?
Walter Roberson
Walter Roberson 2023년 1월 10일
Your code 2 1/2 years ago did not involve fmincon at all, so we cannot guess what your current code looks like.

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

카테고리

Help CenterFile Exchange에서 Solver Outputs and Iterative Display에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by