| Prev | Next | sinwave |
| Syntax |
y = sinwave(fc,pc,fs,N) |
| Syntax |
y = sinwave(fc,pc,fs,N,M) |
| Include: |
include spt\sinwave.oms |
| See Also | sqrwave , 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 sinusoidal
waveform with the requested parameters.
This function generates samples from a sinusoidally 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 'pc'. 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 in 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 zero for zero 'pc' and consists of
samples taken from a waveform with peak value 1.0.
Create two columns of 16 samples of a 1 Hz sinewave sampled at 16 Samples/second.
O>format double "f6.3"
O>sinwave(1,0,16,16,2)
{
[ 1.000 , 1.000 ]
[ 0.924 , 0.924 ]
[ 0.707 , 0.707 ]
[ 0.383 , 0.383 ]
[ 0.000 , 0.000 ]
[ -0.383 , -0.383 ]
[ -0.707 , -0.707 ]
[ -0.924 , -0.924 ]
[ -1.000 , -1.000 ]
[ -0.924 , -0.924 ]
[ -0.707 , -0.707 ]
[ -0.383 , -0.383 ]
[ -0.000 , -0.000 ]
[ 0.383 , 0.383 ]
[ 0.707 , 0.707 ]
[ 0.924 , 0.924 ]
}