# Matlab:New population model

Jump to navigation
Jump to search

## Script

% % NEW MAGICAL GIRL-WITCHES MODEL % This file has been produced for Matlab 7.4.0 % It is 100% compatible with FreeMat 4.0, however, you may want to change the plot commands to % plot(M, 'g.-') and plot(W, 'r.-') for aesthetics purpose % I = 0.25; % Number of girls contracted by Kyubey, depending on the number of witches B = 0.125; % Proportion of girls becoming witches, per iteration F = 0.015; % Proportion of familiars maturing into witches, per iteration D = 0.001; % Proportion of Magical Girls getting killed, either by witches or by other MSes H = 0; % Average heroism of Magical Girls (i.e. number of familiars they fight) K = 0.12; % Number of witches getting killed by Magical Girls steps = 100; % Number of iterations for the simulation M(1) = 10; % Number of magical girls at first W(1) = 0; % Number of witches at first hold on for t=1:steps deltaM = I*W(t) - B*M(t) - D*M(t)*W(t); deltaW = B*M(t) + F*(W(t) - H*M(t)) - K*M(t)*W(t); M(t+1) = M(t) + deltaM; W(t+1) = W(t) + deltaW; end title('Evolution of the Magical Girls population over time') xlabel('time') ylabel('number of magical girls/witches') plot(M, 'g-') plot(W, 'r-') legend('Magical Girls', 'Witches', 'location', 'northeast') legend('boxoff') hold off

## Notes

- Results are dumped on the talkpage (graphs and sets of values used)
- This model is still a work in progress. Do not take it as granted yet