Re: Using "If" and "NDSolve" together
- To: mathgroup at smc.vnet.net
- Subject: [mg107160] Re: Using "If" and "NDSolve" together
- From: JH <jlucio at ubu.es>
- Date: Thu, 4 Feb 2010 06:27:50 -0500 (EST)
- References: <hjeqav$fs3$1@smc.vnet.net>
Hello, Benfeitas: I think you want something like this: Funcao[first_, last_] := solABC = NDSolve[{A'[t] == k0 A0 - k1 A[t], B'[t] == k1 A[t] - k2 B[t], C'[t] == k2 B[t] - k3 C[t], A[0] == 2 10^-6, B[0] == 0, C[0] == 0} /. {k0 -> 10^-2, k1 -> 10^-5, k2 -> 10^-6, k3 -> 10^1, A0 -> If[first < t < last, 1, 0]}, {A, B, C}, {t, 0, 1000}] Plot[A[t] /. solABC, {t, 0, 1000}] This way A[t] should grow higher if first<t<last. I hope it helps you. Jesus.