[Date Index]
[Thread Index]
[Author Index]
Re: NDSolve problem with switching equations
*To*: mathgroup at smc.vnet.net
*Subject*: [mg106226] Re: NDSolve problem with switching equations
*From*: Bill Rowe <readnews at sbcglobal.net>
*Date*: Tue, 5 Jan 2010 01:48:28 -0500 (EST)
On 1/4/10 at 5:59 AM, btreat1 at austin.rr.com (DrMajorBob) wrote:
>First, we need a square wave of amplitude one, zero up to 0.5, 0
>from .05 to 1.0, with period 1.
>The following will do well enough:
>Plot[UnitStep@Sin[2 Pi t], {t, 0, 2}]
=46WIW, if you are using vers 7 or later there is the built in
function SquareWave. That is
Plot[.5 + .5 SquareWave[t],{t, 0, 2}]
produces the same graphic as your code. And using .5 + .5
SquareWave[t] in place of UnitStep@Sin[2 Pi t] in the arguments
to NDSolve appears to get the identical solution. At least the
error plots look the same. On my machine, subjectively, there
didn't seem to be any performance difference for either function
for producing a square wave.
Prev by Date:
**Re: bug in RandomChoice if weight is zero?**
Next by Date:
**Re: printing**
Previous by thread:
**Re: NDSolve problem with switching**
Next by thread:
**Export Dynamic Matrix to XLS**
| |