Group Abstract Group Abstract

Message Boards Message Boards

0
|
4.2K Views
|
2 Replies
|
0 Total Likes
View groups...
Share
Share this post:

ODEs: Changing a parameter during simulation

Posted 10 years ago

Hello, I am a new user of Mathematica, and I have the folowing question.

I am solving a system of ODEs numerically with NDSolve, the independent variable being time (t), and I would like to change a parameter during the time course. E.g., for a particular parameter {p - > 0.9} I would like to set it to 1.0 if 200 < t <= 500 and for t > 500 reset it to 0.9. How can this be done? I have tried with „WhenEvent“ but I didn’t succeed.

Thanks a lot in advance, Christian

POSTED BY: Christian Klein
2 Replies
Posted 10 years ago

Thanks a lot, that works!

Kind regards, Christian

POSTED BY: Christian Klein

You can use something like this:

In[7]:= p[t_] := If[200 < t <= 500, 1, 0.9]

In[8]:= p[100]

Out[8]= 0.9

In[10]:= p[300]

Out[10]= 1

In[11]:= p[600]

Out[11]= 0.9
POSTED BY: S M Blinder
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard