DADiSP Worksheet Functions > Function Categories > Generated Series > GRTSQR

 

GRTSQR

Purpose:

Generates a square wave with a specified rise time.

Syntax:

GRTSQR(length, spacing, frequency, phase, rt, duty)

length

-

An integer, the length of the output series.

spacing

-

A real, the spacing (delta x) between each point on the x-axis.

frequency

-

Optional. A real, the frequency specified in cycles per second (Hertz). Defaults to 1.

phase

-

Optional. A real, the phase specified in radians. Defaults to 0.

rt

-

Optional. A real, the rise time in seconds. Defaults to 0.1.

duty

-

Optional. A real, between 0 and 100. The duty cycle, the percentage of a period the squarewave is "on". Defaults to 50.0.

Returns:

A series.

Example:

grtsqr(100, .01, 3, 0, .04)

 

generates 100 points of a 3 Hz square wave with a rise time of 0.04 seconds.

 

image\gsqrtpic.gif

 

Example:

grtsqr(100, .01, 3, 0, .04, 30)

 

same as above except the duty cycle is 30%.

Remarks:

Filters an ideal square wave with a single pole low pass analog filter to produce a square wave with a specified rise time. The rise time is defined as the time required for a step to go from 10% to 90% of final value. The desired rise time rt = τ, specifies the low pass cutoff frequency of the filter as follows:

 

Fc = 2.2 / 2πτ

 

The squarewave is normalized with an amplitude of 0.0 to 1.0 Volts.

 

The single pole analog lowpass filter is implemented in the digital domain using the impulse invariance technique.

See Also:

GSQRWAVE

LOWPASS

SLP