- Use MATLAB's 'ode45' function to solve the differential equations. You can refer to the below given documentation: https://www.mathworks.com/help/matlab/ref/ode45.html
- Write the equations 'S'(t)' and 'I'(t)' as a system. Here is a snippet of code you can refer to:
- After solving for one interval, update 'S' using 'g(t,S)'. You can refer to the below given code snippet:
- Solve the problem iteratively for each interval [kT,(k+1)T], updating 'S' and 'I' at each step.