Trying to plot response after the transients have died out

1 次查看(过去 30 天)
clear H L year
H(1) = 10; L(1) = 10;
% For simplicity, keep track of the year as well
year(1) = 1845;
% Set up parameters (note that c = a in the model below)
br = 0.6; df = 0.7; a = 0.014;
nperiods = 365; % simulate each day
duration = 90; % number of years for simulation
% Iterate the model
for k = 1:duration*nperiods
%c = br; % constant food supply
b = br*(1+0.5*sin(2*pi*k/(4*nperiods))); % varying food supply
H(k+1) = H(k) + (b*H(k) - a*L(k)*H(k))/nperiods;
L(k+1) = L(k) + (a*L(k)*H(k) - df*L(k))/nperiods;
year(k+1) = year(k) + 1/nperiods;
if (mod(k, nperiods) == 1)
% Store the annual population
Ha((k-1)/nperiods + 1) = H(k);
La((k-1)/nperiods + 1) = L(k);
end;
end;
% Store the final population
Ha(duration) = H(duration*nperiods+1);
La(duration) = L(duration*nperiods+1);
% Plot the populations of rabbits and foxes versus time
figure(3); clf;
plot(1845 + [1:duration], Ha, 'b.-', 1845 + [1:duration], La, 'g.--');
%
axis([1845 1944 0 250]);
xlabel('Year');
ylabel('Population');
legend('hares','lynxes')
title('Varying food supply')
This is the code I have and I have found the transient response of the system but however, I am looking to find the response after the transients have died out but I am not able to know how to do it. It would be great if I can find any help.

回答(1 个)

Balavignesh
Balavignesh 2024-3-15
Hi Aditya,
It looks like you have found the transient response of the system, and now you would like to analyze the steady state characteristics i.e., after all the transients have died out. Transients in dynamical systems typically die out after sufficient time has passed, leaving the system in a behavior that is representative of it's long-term dynamics.
Since your transients haven't died out within the 90-year simulation, I extended the duration to 200 years to allow more time for the system to settle. The system didn't reach steady state even then, but continued following the same pattern.
Hence, I would suggest adjusting the model parameters so that the system will reach an expected behaviour. The adjustments could involve changing the birth rate, death rate, or other parameters to see how the affect the system's long-term behavior.
Remember, the goal is to let the simulation run long enough that you can confidently say the dynamics you're observing are representative of the system's behavior, independent of its initial conditions.
Hope this helps!
Balavignesh

类别

Help CenterFile Exchange 中查找有关 Financial Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by