How can I set the range of inital value if there are more than one.

1 visualización (últimos 30 días)
Hi, I want to vary the inital value of VI(infectious virus), leaving others fixed. below is what I tried to do that, I set the range of VI as VI0, and put it in y0 which is series of initial values. but when I run this code, ""@(T,Y)HIV(T,Y,I) returns a vector of length 5, but the length of initial conditions vector is 8. The vector returned by @(T,Y)HIV(T,Y,I) and the initial conditions vector must have the same number of elements.""" this error occured. I know why this error took place, but dont know how to fix this.. anyone any idea for this please?
thank you!
tspan=[0,60];
VI0 =[1,10,100,1000];
y0 = [10^11,0,0,VI0,0];
I.Tu = 1;
I.T1 = 2;
I.T2 = 3;
I.VI = 4;
I.VNI = 5;
[times,ys] = ode45(@(t,y)HIV(t,y,I),tspan,y0);
plot(times,ys)
function dydt = HIV(~,y,I)
lamda = 2*10^9;
k = 8*10^-12;
delta_Tu = 0.02;
delta_T1 = 0.02;
delta_T2 = 1;
CL = 23;
kT = 0.35;
N = 1000;
q = 0.67;
dydt=zeros(5,1);
dydt(I.Tu)=lamda - delta_Tu*y(I.Tu) - k*y(I.VI)*y(I.Tu)
dydt(I.T1)=k*y(I.VI)*y(I.Tu) -kT*y(I.T1) - delta_T1*y(I.T1)
dydt(I.T2)=kT*y(I.T1) - delta_T2*y(I.T2)
dydt(I.VI)=q*N*delta_T2*y(I.T2) - CL*y(I.VI) - k*y(I.VI)*y(I.Tu)
dydt(I.VNI)=(1-q)*N*delta_T2*y(I.T2) - CL*y(I.VNI)
end

Respuesta aceptada

madhan ravi
madhan ravi el 27 de Jun. de 2020
Loop the function for VI0.
Naming a variable times is a terrible idea.

Más respuestas (0)

Categorías

Más información sobre MATLAB en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by