swage_pulse

<< Click to Display Table of Contents >>

Navigation:  Sample Problems > Usage > Functions >

swage_pulse

Previous pageReturn to chapter overviewNext page

{ SWAGE_PULSE.PDE  

 

 A pulse can be made by two ifs:

 r1 = IF x<x1 THEN 0 ELSE 1

 r2 = IF x<x2 THEN 1 ELSE 0

 pulse = r1*r2

 

 This can be directly translated in to SWAGE or RAMP statements with width W:

 spulse = SWAGE(x-x1,0,1,w) * SWAGE(x-x2,1,0,w)

 rpulse = RAMP(x-x1,0,1,w) * RAMP(x-x2,1,0,w)

 

}  

 

title "SWAGE and RAMP Pulses"  

 

select  

   elevationgrid=2000  

 

{ -- No variables, no equations -- }  

 

definitions  

 x1 = -0.5  

 x2 = 0.5  

 w = 0.05  

 swage_pulse = SWAGE(x-x1,0,1,w) * SWAGE(x-x2,1,0,w)  

 ramp_pulse = RAMP(x-x1,0,1,w) * RAMP(x-x2,1,0,w)  

 

boundaries  

  region 1  

    start(-1,-0.1) line to (1,-0.1) to (1,0.1) to (-1,0.1) to close  

 

plots  

  elevation(swage_pulse) from (-1,0) to (1,0)  

  elevation(ramp_pulse) from (-1,0) to (1,0)  

 

end