optimization of delayed differential equations (dde)

조회 수: 6 (최근 30일)
Malgorzata Wieteska
Malgorzata Wieteska 2022년 5월 9일
댓글: Torsten 2024년 3월 14일
Hello,
I try to optimise (finding the parameter's value) in the system of dde, unfortunately I can't find any example how to do it. I used to optimization of ode using ode45 solver with lsqlin for instance. I will appreciate the help. The dde23 seems not to be working with lsqlin. I will appreciate any help.
  댓글 수: 1
Torsten
Torsten 2022년 5월 9일
편집: Torsten 2022년 5월 9일
Do you have a code for your model equations set up with dde23 ?
If yes, you should include it and tell which parameter(s) you are trying to optimize on the basis of which input data.

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

채택된 답변

Torsten
Torsten 2022년 5월 9일
편집: Torsten 2022년 5월 9일
Make the best of it.
pTrue = [1 1 1 1 1 1 1 1 1];
time = 0:7;
Y = ...;
Am1=[1,1.1,1.4,0.7,0.8,1.6,2,1.5];
Bm1=[1.5,1.0,0.4,1.7,0.9,1.3,1.5,1.4];
Am=@(t)interp1(time,Am1,t)
Bm=@(t)interp1(time,Bm1,t)
p = lsqnonlin(@(p) Errors(p,time,Y,Am,Bm),0.8*pTrue)
function res = Errors(p,time,Y,Am,Bm)
lags=[1,2];
[T,SOL]=dde23(@(t,y,Z)ddefunEx(t,y,Z,p,Am,Bm), lags, [1,1,1,1], time);
res = Y-SOL;
res = res(:);
end
function dydt = ddefunEx(t,y,Z,p,Am,Bm)
ylag1 = Z(:,1);
ylag2 = Z(:,2);
E1p=y(1)
E2p=y(2)
A1=y(3)
B1=y(4)
n_A=p(1);%0.6;
n_B=p(2);%0.1;
KE1=p(3);%0.2;
KE2=p(4);%0.2;
Vp_A=p(5);%1.2;
Vp_B=p(6);%1.5;
alpha_p=p(7);%0.4;
kA=p(8);%0.4;
kB=p(9);%1.2;
%Auxiliary equations
ALPHA1=n_A*E1p*A1/(KE1*(1+A1))-A1;
ALPHA2=n_B*E2p*B1/(KE2*(1+B1))-B1;
dydt= [Vp_A*Am(t)-alpha_p*ylag1(1);
Vp_B*Bm(t)-alpha_p*ylag1(2);
kA*Am(t)-ylag2(3)-ALPHA1+ALPHA2;
kB*Bm(t)-ylag2(4)+ALPHA1-ALPHA2];
end
  댓글 수: 4
Priya Verma
Priya Verma 2024년 3월 14일
how to plot graphs between lags and variables for dde ?...please reply ..
Torsten
Torsten 2024년 3월 14일
What do you mean by your question ? The line
[T,SOL]=dde23(@(t,y,Z)ddefunEx(t,y,Z,p,Am,Bm), lags, [1,1,1,1], time);
gives you a solution SOL at times T that you can plot. How do you think that the lags come into play ?

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

추가 답변 (1개)

Malgorzata Wieteska
Malgorzata Wieteska 2022년 5월 9일
% I'm embedding simplified version of the system. I run it the function ddedunEx to get simulated data (Y) and then try to optimise for the values of the parameters against obtained earlier data.
function dydt = ddefunEx(t,y,Z,p)
%global p
ylag1 = Z(:,1);
ylag2 = Z(:,2);
time=0:7;
E1p=y(1)
E2p=y(2)
A1=y(3)
B1=y(4)
Am1=[1,1.1,1.4,0.7,0.8,1.6,2,1.5];
Bm1=[1.5,1.0,0.4,1.7,0.9,1.3,1.5,1.4];
Am=interp1(time,Am1,t)
Bm=interp1(time,Bm1,t)
n_A=p(1);%0.6;
n_B=p(2);%0.1;
KE1=p(3);%0.2;
KE2=p(4);%0.2;
Vp_A=p(5);%1.2;
Vp_B=p(6);%1.5;
alpha_p=p(7);%0.4;
kA=p(8);%0.4;
kB=p(9);%1.2;
%Auxiliary equations
ALPHA1=n_A*E1p*A1/(KE1*(1+A1))-A1;
ALPHA2=n_B*E2p*B1/(KE2*(1+B1))-B1;
dydt= [Vp_A*Am-alpha_p*ylag1(1);
Vp_B*Bm-alpha_p*ylag1(2);
kA*Am-ylag2(3)-ALPHA1+ALPHA2;
kB*Bm-ylag2(4)+ALPHA1-ALPHA2;];
end
%lags=[1,2];
%tspan=0:7;
%sol = dde23(@ddefunEx, lags, [1,1,1,1], tspan);
%figure(2)
%plot(sol.x,sol.y)
%%%%%%%%%%%%% Obtaining data
%Y=sol.y+0.05*randn(size(sol.x));
function res=Errors(p,Y)
tspan=0:7;;
x0=[4;1];
lags=[1,2];
[T,X]=dde23(@ddefunEx, lags, [1,1,1,1], tspan);
res1=(X(:,1)-Y(:,1));
res2=(X(:,2)-Y(:,2));
res3=(X(:,3)-Y(:,3));
res4=(X(:,4)-Y(:,4));
res=abs(res1)+abs(res2) +abs(res3)+abs(res4);
%pTrue=[0.6;0.1;0.2;0.2];
%[pOpt,resnorm,res,exitflag,~,lambda,J]=...
% lsqnonlin(@(p) Errors(p,Y),0.8*pTrue);
  댓글 수: 2
Priya Verma
Priya Verma 2024년 3월 14일
these command is not running in my matlab...please share all code..
Priya Verma
Priya Verma 2024년 3월 14일
what are define Am1 and Bm1 ?

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

카테고리

Help CenterFile Exchange에서 Stochastic Differential Equation (SDE) Models에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by