Parameter Estimation for Differential Equation according to data measured
古いコメントを表示
Thanks in advance to all supporters, this is the first time a ask a question - that's because there are answers to most of the problems i had.
After reviewing the proposed solution :

- i tried to apply "Star Strider" ‘Igor_Moura’ function to another ode problem i have but get Error "using lsqcurvefit"
- i did a modification to your code to solve the eq:

- A,B,C are parameters i look for ([A B C] inside the code are theta(1:3). [y,y'] are c(1:2), dcdt(2) is [y''] and x is t)
function C=kinetics(theta,t)
c0=[293;0]; %initial condition
[T,Cv]=ode45(@DifEq,t,c0);
%
function dC=DifEq(t,c)
dcdt=zeros(2,1);
dcdt(1)=c(2);
dcdt(2)=theta(3)-theta(2).*c(1)-theta(1).*t.*c(2);
dC=dcdt;
end
C=Cv;
end
global t c
load('t.mat'); t=t*1000;
load('c.mat');
theta0=[1;1;1]; % initial guess
[theta,Rsdnrm,Rsd,ExFlg,OptmInfo,Lmda,Jmat]=lsqcurvefit(@kinetics,theta0,t,c);
fprintf(1,'\tRate Constants:\n')
for k1 = 1:length(theta)
fprintf(1, '\t\tTheta(%d) = %8.5f\n', k1, theta(k1))
end
- unfortunately, I encounter a problem of dimensions :
Error using lsqcurvefit (line 248)
Function value and YDATA sizes are not equal.
- at line 199 :

- initVals.F get the size :

- so at line 248 :

- i got the err because YDATA length is 18896X1 so their sizes are not equal.
any idea?? thanks Netanel
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Plot Settings についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


