MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: NDSolve plot problem

  • To: mathgroup at smc.vnet.net
  • Subject: [mg79331] Re: NDSolve plot problem
  • From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
  • Date: Wed, 25 Jul 2007 02:00:04 -0400 (EDT)
  • Organization: The Open University, Milton Keynes, UK
  • References: <f84iqn$oqj$1@smc.vnet.net>

Jake Trexel wrote:
> Needing help with plots of equations.
> I have the following eqs and I get a nice plot.  But what I want is for the 
> same plot to continue for 3 to  4 times and then a negative plot at then 
> end.  How do I go about this?
> 
> thank you
> Jake
> i[t_] := If[t < 10 || t > 60, 0, 1]
> 
> Plot[i[t], {t, 0, 100}, AxesLabel -> {"t = time", "i = current"}]
> 
> RCSoln[R_, c_: 1, v0_: 0] := 
> NDSolve[{v'[t]==1/c{i[t]-v[t]/R},v[0]==v0,}t,0,100}]
> Plot[Evaluate[v[t]/. {RCSoln[2]}],{t,0,100}]

Hi Jake,

Do you have something like this in mind?

i[t_] := If[10 <= t <= 60 || 110 <= t <= 160 || 210 <= t <= 260, 1,
   If[310 <= t <= 360, -1, 0]]

Plot[i[t], {t, 0, 400}, AxesLabel -> {"t = time", "i = current"}]

RCSoln[R_, c_: 1, v0_: 0] :=
  NDSolve[{v'[t] == 1/c (i[t] - v[t]/R), v[0] == v0}, v, {t, 0, 400}]

Plot[Evaluate[v[t] /. {RCSoln[2]}], {t, 0, 400},
  AxesLabel -> {"t = time", "v = voltage"}]

Regards,
Jean-Marc


  • Prev by Date: Re: Searching list for closest match to p
  • Next by Date: Re: How to draw a discontinuous function (set of points)
  • Previous by thread: Re: NDSolve plot problem
  • Next by thread: Novice/Integral