Hi Xinyi Zhou
To estimate the transmission rate β of an infection using the SIR model (Susceptible, Infected, Recovered) using MATLAB's ode45 solver, you need to set up the differential equations and solve for β. Here's how you can approach it.
The SIR model is described by the following set of ordinary differential equations (ODEs):
Please refer to the steps given in the following code snippet below to estimate β:
function dSIRdt = sir_model(t, SIR, beta, N, gamma)
dI = beta * S * I / N - gamma * I;
function error = objective(beta, tspan, SIR0, N, gamma, x)
[~, SIR] = ode45(@(t, SIR) sir_model(t, SIR, beta, N, gamma), tspan, SIR0);
beta_initial_guess = 0.3;
beta_estimated = fminsearch(@(beta) objective(beta, tspan, SIR0, N, gamma, x), beta_initial_guess);
disp(['Estimated beta: ', num2str(beta_estimated)]);
Please refer to the following documentation link to learn more about fminsearch function and ode45 solver.
Hope this helps.