| Prev | Next | sqrwave |
| Syntax |
y = sqrwave(fc,pc,fs,N) |
| Syntax |
y = sqrwave(fc,pc,fs,N,M) |
| Include: |
include spt\sqrwave.oms |
| See Also | sinwave , sawwave , triwave |
ARGUMENTS:
INPUTS:
'fc' = SCALAR, any numerical type. Center frequency [Hz]
Coerced to DOUBLE for local processing.
'pc' = SCALAR, any numerical type, Constant phase angle
of carrier [radians]. Coerced to DOUBLE for
local processing.
'fs' = SCALAR, any numerical type. Sampling rate
[Samples/second]. Coerced to DOUBLE for local
processing.
'N' = SCALAR, any numerical type. Requested row
dimension (number of samples). Coerced to DOUBLE
for local processing.
'M' = SCALAR, any numerical type. Requested column
dimension (optional). Coerced to DOUBLE for local
processing.
RETURN: MATRIX, DOUBLE, each column being a sampled
squarewave waveform with the requested parameters.
This function generates samples from a squarewave shaped waveform. The
frequency of the waveform in [Hz] is specified through
argument 'fc'. A delay in the waveform, expressed in [radians]
is input via argument 'phase'. The sampling rate of the system
is given through 'fs' in [Samples/second]. All of these may be
of any numerical type and are all coerced to DOUBLE for local
processing. The number of requested samples is given through
argument 'N' and will be the row dimension of the returned
matrix. If 'M' is included a matrix will be returned where
each of M columns is an identical copy of the requested
waveform. If 'M' is omitted a column vector is returned.
The returned waveform starts at unity for zero 'pc' and
consists of samples taken from a waveform with peak value 1.0.
O>format double "f6.3"
O>sqrwave(1,0,16,16,2)
{
[ 1.000 , 1.000 ]
[ 1.000 , 1.000 ]
[ 1.000 , 1.000 ]
[ 1.000 , 1.000 ]
[ 1.000 , 1.000 ]
[ 1.000 , 1.000 ]
[ 1.000 , 1.000 ]
[ 1.000 , 1.000 ]
[ -1.000 , -1.000 ]
[ -1.000 , -1.000 ]
[ -1.000 , -1.000 ]
[ -1.000 , -1.000 ]
[ -1.000 , -1.000 ]
[ -1.000 , -1.000 ]
[ -1.000 , -1.000 ]
[ -1.000 , -1.000 ]
}