Last active
November 17, 2015 22:59
-
-
Save matiskay/fc6d1367fb3a47bc8664 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\documentclass[a4paper,12pt]{article} | |
\usepackage{upquote} | |
\usepackage{listings} | |
% Check | |
\definecolor{ao(english)}{rgb}{0.0, 0.5, 0.0} | |
\definecolor{ao}{rgb}{0.0, 0.0, 1.0} | |
\definecolor{alizarin}{rgb}{0.82, 0.1, 0.26} | |
\definecolor{byzantium}{rgb}{0.44, 0.16, 0.39} | |
\definecolor{burntorange}{rgb}{0.8, 0.33, 0.0} | |
\usepackage{inconsolata} | |
\renewcommand{\lstlistingname}{Algorithm} | |
% Based on https://gist.github.com/eyliu/120689 | |
\lstset{language=Matlab, | |
frame=single, | |
showspaces=false, | |
showtabs=false, | |
breaklines=true, | |
showstringspaces=false, | |
breakatwhitespace=true, | |
escapeinside={(*@}{@*)}, | |
morekeywords={plot, title, xlabel}, | |
morekeywords=[2]{alpha, beta, theta, kappa, gamma}, | |
deletekeywords={alpha, beta, gamma}, | |
commentstyle=\usefont{T1}{pcr}{m}{sl}\color{ao(english)}\small, | |
numbers=left, | |
keywordstyle=\color{ao} \bfseries, | |
keywordstyle=[2]\color{burntorange} \bfseries, | |
stringstyle=\color{alizarin}, | |
basicstyle=\ttfamily\small, | |
numberstyle=\ttfamily, | |
} | |
\begin{document} | |
\lstinputlisting[caption={Modelo SEIRS},label=lst:seir_model,firstline=14]{seirs.m} | |
\end{document} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% SEIRS model | |
% Inputs: | |
% t - time variable: not used here because our system | |
% is independent of the time (autonomous) | |
% x - independent variable: this contains the populations. | |
% Output: | |
% dx - First derivative: The rate of change of the population. | |
% S = dx_dt(1) | |
% E = dx_dt(2) | |
% I = dx_dt(3) | |
% R = dx_dt(4) | |
function dx_dt = seirs_model(t, x) | |
dx_dt = [0; 0; 0; 0]; | |
alpha = 0.375; | |
beta = 0.1; | |
gamma = 0.143; | |
theta = 0.004; | |
kappa = 0.00042; | |
dx_dt(1) = - alpha * x(1) + theta * x(4); | |
dx_dt(2) = alpha * x(1) - beta * x(2); | |
dx_dt(3) = beta * x(2) - kappa * x(3) - gamma * x(3); | |
dx_dt(4) = gamma * x(3) - theta * x(4); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment