Problem regarding a periodic solution not being saved properly
이전 댓글 표시
Hello! I am working on a problem where I have to solve an ODE for time of 10 years and then check when and where that solution becomes periodic. I want to store the value of the periodic solution and the interval when it becomes periodic. This is what I tried so far:
clear all;
p=10;% Number of year for which simulation runs
y0=20000; % Initial condition
tspan=0:1:10*365;
epsilon=1e-10; % Tolerance for periodicty condition which is defined further
t=0:3650; % This t will be used in the following parameter m files
%Calling some parameters
mugen;
Kgen;
d1gen;
delta1gen;
[X Y] = ode15s(@(t,y)para1(t,y,mug,Kg,d1g,delta1g),tspan,y0);
if (X>=365) & (abs(Y(X)-Y(:,X-365))<epsilon) % Check for every
%time value if the solution
%is periodic by using the definition of periodicity.
YcSteady(X)=Y(:,X); % Store the periodic the solution found
XcSteady(X,:)=[X-365 X]; % Store time interval when periodic solution occurs
end
Now, the problem is that it does not store YcSteady which is the time at which periodicity condition is satisfied and XcSteady which is the time interval between which the condition is satisfied!
Thanks!
댓글 수: 4
Star Strider
2014년 7월 5일
It would be easier to answer if we could run your code. We have no idea what X and Y are numerically, so we cannot evaluate your logic. We at least seem to be missing para1. Attaching it would help.
Rose
2014년 7월 5일
Rose
2014년 7월 5일
Rose
2014년 7월 5일
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Ordinary Differential Equations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!