# MATLAB: Changing parameters in an ODE

matalbode

I wish to change one of the parameters at each time step for an ODE solution plot. My function is as follows:
    function [t,v]=shig(b,p,m,yo)    [t v] = ode45(@fnsirtry,[0 12],yo);        function fnsir = fnsirtry(t,v)            a = 0.25;            r = 0.14;            fnsir(1) = p - m*v(1)-b*v(1)*v(2)+a*v(3);            fnsir(2) = (b*v(1))- (m + r)*v(2);            fnsir(3) = (r*v(2))-((m+a)*v(3));            fnsir = fnsir(:);        end    end
When I plot the ODE, I want to change the value of b at each step. I have used a code like teh following:
temp = [5 9 12 17 19 24 28 27 22 17 10 7];beta = 0.0000025*temp;i = [1 2 3 4 5 6 7 8 9 10 11 12];for i = 1;    b = beta(:,1)endfor i = 2;    b = beta(:,2)endfor i = 3;    b = beta(:,3)endfor i = 4;    b = beta(:,4)endfor i = 5;    b = beta(:,5)endfor i = 6;    b = beta(:,6)endfor i = 7;    b = beta(:,7)endfor i = 8;    b = beta(:,8)endfor i = 9;    b = beta(:,9)endfor i = 10;    b = beta(:,10)endfor i = 11;    b = beta(:,11)endfor i = 12;    b = beta(:,12)endP = 5000;m = 0.013;yo = [200000 160 0]; [t v] = shig(b,p,m,yo);w = [1591481431371029185137119108104100];subplot (1,2,1)plot(t,v(:,2))%,'-r*','Linewidth',1.5,'MarkerSize',5)title('Infected Population')%legend('Disease free state','Test state')subplot(1,2,2)plot(w)
Could I please get some light on this,, pls…

for k1 = 1:12    [t{k1}, v{k1}] = shig(beta(:,k1),p,m,yo);end