Azzera filtri
Azzera filtri

Info

Questa domanda è chiusa. Riaprila per modificarla o per rispondere.

Applying higher value of input parameter for some interval input variable in ODE.

1 visualizzazione (ultimi 30 giorni)
N=10;
k=zeros(N,1);
r=zeros(N,1);
t=zeros(N,1);
k1=1;k(1)=1;t(1)=0;dt=0.05;
for i=2:N
t(i)=t(i-1)+dt;
k(i)=k1;
r(i)=r(i-1)*dt+k(i);
if r(i)<5
% I want to apply higher value of k i.e. k1+1 for some
% interval of time before and after t(i) at which r(i) is equal to 0.5.
% For example if t(i)=10 for r(i)=0.5, then
% I want to use higher value of k in the time range of 5 to 15.
k(i)=k1+1;
r(i)=r(i-1)*dt+k(i);
end
end
plot(t,r)

Risposte (0)

Questa domanda è chiusa.

Community Treasure Hunt

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

Start Hunting!

Translated by