Filter löschen
Filter löschen

Info

Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.

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

1 Ansicht (letzte 30 Tage)
Dharma
Dharma am 10 Apr. 2018
Geschlossen: MATLAB Answer Bot am 20 Aug. 2021
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)

Antworten (0)

Diese Frage ist geschlossen.

Community Treasure Hunt

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

Start Hunting!

Translated by