<< Click to Display Table of Contents >> unit_functions |
{ UNIT_FUNCTIONS.PDE
This example illustrates the unit step, unit pulse,
and unit ramp functions ustep(arg1), upulse(arg1,arg2),
and uramp(arg1,arg2) See Unit Functions.
}
title
"unit functions"
select
elevationgrid=500
{no variables}
definitions
x1 = 0.2
x2 = 0.4
{no equations}
{plot domain -- required}
boundaries
region 1
start (-1,0)
line to (1,0) to (1,1) to (-1,1) to close
plots
elevation(ustep(x-x1)) from (0,0) to (1,0)
elevation(dx(ustep(x-x1))) from (0,0) to (1,0)
elevation(upulse(x-x1,x-x2)) from (0,0) to (1,0)
elevation(dx(upulse(x-x1,x-x2))) from (0,0) to (1,0)
elevation(uramp(x-x1,x-x2)) from (0,0) to (1,0)
elevation(dx(uramp(x-x1,x-x2))) from (0,0) to (1,0)
! generating a square wave by clipping a cosine
elevation(ustep(cos(4*pi*x))) from (-1,0) to (1,0)
! the duty cycle can be controlled by offsetting the cosine from zero
elevation(ustep(cos(4*pi*x)-0.3)) from (-1,0) to (1,0)
end