How can I write this differential equation system in MATLAB? I am newbie MATLAB user. How to write this equation system in MATLAB?
$$\frac{dN_{ik}}{dt}=\sum_{j=i}^{n}\sum_{l=1}^{n}\beta_{jl}b_{ikjl}S_{jl}N_{jl} - S_{ik}N_{ik}$$
Here, I want to know if I take $n=3$ or any constant number what kind of equation system will I have?
How can i run this loop without entering $\beta$, $b$ and $S$ functions. I just want to see matrix form of this system. Sorry for my bad English,  thanks for help.
 A: The function for the right-hand side and arbitrary parameters should look something like this:
function dNdt = rhs(t,N,par)

dNdt = zeros(length(N),1);
nk = length(N)/par.n;

for i = 1 : par.n
    for k = 1 : nk
        for j = i : par.n
            for l = 1 : par.n
                dNdt((i-1)*nk + k) = dNdt((i-1)*nk + k) + beta(j,l) * b(i,k,j,l) * S(j,k) * N((j-1)*nk + k) - S(i,k) * N((i-1)*nk + k);
            end
        end
    end
end

where you need to provide the parameter $n$ and the implementations of the functions $\beta, b$ and $S$.

To have it run in Matlab, type
[t,N] = ode45(@(t,N)rhs(t,N,par), [t0, te], N0);

where the first argument is an anonymous function allowing for passing over a third argument (the parameter struct par), $t_0$ is start time, $t_e$ is end time and $N_0$ are initial conditions. Note that $N_0$ needs to have $n \cdot n_k$ components.

Choosing $n = n_k = S = \beta = N_0 = 1$ and $b = 0.5$ yields the following result for $t \in [0, 1]$:

Choosing $n = n_k = 2$, $S = \beta = 1$, $N_0 = (.2, .3, .4, .5)^T$ and $b = 0.5$ returns

