You have to use the output of the first ODE at time ti
as the initial condition for the second ODE.
ODE #1
DSolveValue[
{
p0 + vi[t]/c0 + r0 Derivative[1][vi][t] == p1,
vi[0] == 0
},
vi[t],
t]
(* -c0 E^(-(t/(c0 r0))) (-1 + E^(t/(c0 r0))) (p0 - p1) *)
Now we use the answer to define vi[t]
.
vi[t_] := -c0 E^(-(t/(c0 r0))) (-1 + E^(t/(c0 r0))) (p0 - p1)
We evaluate it at time ti
to be used as the initial condition for the second ODE.
vi[ti]
(* -c0 E^(-(ti/(c0 r0))) (-1 + E^(ti/(c0 r0))) (p0 - p1) *)
ODE #2
We use the value of vi[ti]
as the initial condition in the second ODE.
DSolveValue[
{
p0 + ve[t]/c0 + r0 Derivative[1][ve][t] == 0,
ve[ti] == -c0 E^(-(ti/(c0 r0))) (-1 + E^(ti/(c0 r0))) (p0 - p1)
},
ve[t],
t]
(* -c0 E^(-(t/(c0 r0))) (-p0 + E^(t/(c0 r0)) p0 + p1 - E^(ti/(c0 r0)) p1) *)
and use the answer to define the function ve[t]
ve[t_] := -c0 E^(-(t/(c0 r0))) (-p0 + E^(t/(c0 r0)) p0 + p1 - E^(ti/(c0 r0)) p1)
Now combine the two functions into one (a voltage?).
v[t_] := Piecewise[{
{vi[t], t <= ti}
},
ve[t]
]
Set some values for the parameters and plot the result.
r0 = 5;
p0 = 1;
c0 = 1;
p1 = 3;
ti = 1;
Plot[v[t], {t, 0, 2}, PlotStyle -> Black]
ic2 = Ve[t] == Vi[t]
. You need to give it a specific value at some specific time. may beic2 = Ve[0] == Vi[0]
or something like this. I also do not understandVe(t[i])=Vi(t[i])
what isi
here? $\endgroup$Ve[5]==someValue
, Otherwise, I am not sure how giving an interval is going to work. I never seen an ODE solved using interval for initial conditions. $\endgroup$t[i]
to 0 ({t, sol ,0}
)? $\endgroup$