MATLAB: How in Matlab R2019b fix error in ode45 solver command in solving a dynamic system consists of multiple ODEs equations

MATLABMATLAB and Simulink Student Suitesolveing system of odes ode45 solver rk4 by ode45 matlab ode45 matlab solving state equations

I am sovling a system of 6 ODE functions, using ODE45 solver for RK4 method, i did as follows:
  1. i defined my function of ODEs in one file describing set of ODEs
  2. in another file i try to call this ODEs and solve it by ode45, here i inserted also model constants. initial values. etc.
but in matlab in command line of the ode45 sovler it keep returns error, though there were no any other error notification in other line.
3. Then i tryed to write both m files scripts into one m file conclude two function loops.
the result is same . always showing me error in ODE45 commend line in matlab, i need helpful resources. please have a look on my matlab scripts i uploaded. Thanks.

Best Answer

Mistakes
Also i suggest you to re-write your equations:
dxdt(1,1) = delH*N-(1-u1)*lamH*(x(6)/N)*x(1)-delH*x(1)+alfa*x(3);
dxdt(2,1) = (1-u1)*lamH*(x(6)/N)*x(1) -(delH+gamma+mu*u1)*x(2);
dxdt(3,1) = (gamma+mu*u1)*x(2)-(delH+alfa)*x(3);
dxdt(4,1) = ovip-(eta+epslL+delL)*x(4);
dxdt(5,1) = eta*x(4)-(1-u1)*lamV*(x(2)/N)*x(5)-(epslV*u2+delV)*x(5);
dxdt(6,1) = (1-u1)*lamV*(x(2)/N)*x(5)-(epslV*x(2)+delV)*x(4);
Because of:
[1 1;1 -1] % OK
[1 1;1-1] % ERROR DIMENSIONS
You can define constants outside the function:
Why don't you use variables?
% variables S_H=x(1);I_H=x(2);R_H=x(3);L_V=x(4);S_V=x(5);I_V=x(6);