@ohos-ports/stdlib-simulate 0.4.1-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +177 -0
- package/NOTICE +1 -0
- package/README.md +188 -0
- package/SECURITY.md +5 -0
- package/docs/types/index.d.ts +43 -0
- package/iter/README.md +142 -0
- package/iter/awgn/README.md +240 -0
- package/iter/awgn/docs/repl.txt +85 -0
- package/iter/awgn/docs/types/index.d.ts +155 -0
- package/iter/awgn/docs/types/test.ts +150 -0
- package/iter/awgn/lib/defaults.js +38 -0
- package/iter/awgn/lib/index.js +55 -0
- package/iter/awgn/lib/main.js +278 -0
- package/iter/awgn/package.json +68 -0
- package/iter/awln/README.md +238 -0
- package/iter/awln/docs/repl.txt +85 -0
- package/iter/awln/docs/types/index.d.ts +155 -0
- package/iter/awln/docs/types/test.ts +150 -0
- package/iter/awln/lib/defaults.js +38 -0
- package/iter/awln/lib/index.js +55 -0
- package/iter/awln/lib/main.js +299 -0
- package/iter/awln/package.json +72 -0
- package/iter/awun/README.md +238 -0
- package/iter/awun/docs/repl.txt +85 -0
- package/iter/awun/docs/types/index.d.ts +155 -0
- package/iter/awun/docs/types/test.ts +150 -0
- package/iter/awun/lib/defaults.js +38 -0
- package/iter/awun/lib/index.js +55 -0
- package/iter/awun/lib/main.js +305 -0
- package/iter/awun/package.json +68 -0
- package/iter/bartlett-hann-pulse/README.md +331 -0
- package/iter/bartlett-hann-pulse/docs/img/equation_bartlett_hann_pulse_waveform.svg +191 -0
- package/iter/bartlett-hann-pulse/docs/repl.txt +54 -0
- package/iter/bartlett-hann-pulse/docs/types/index.d.ts +105 -0
- package/iter/bartlett-hann-pulse/docs/types/test.ts +89 -0
- package/iter/bartlett-hann-pulse/lib/index.js +54 -0
- package/iter/bartlett-hann-pulse/lib/main.js +192 -0
- package/iter/bartlett-hann-pulse/lib/validate.js +97 -0
- package/iter/bartlett-hann-pulse/package.json +76 -0
- package/iter/bartlett-pulse/README.md +328 -0
- package/iter/bartlett-pulse/docs/img/equation_bartlett_pulse_waveform.svg +128 -0
- package/iter/bartlett-pulse/docs/repl.txt +54 -0
- package/iter/bartlett-pulse/docs/types/index.d.ts +105 -0
- package/iter/bartlett-pulse/docs/types/test.ts +89 -0
- package/iter/bartlett-pulse/lib/index.js +54 -0
- package/iter/bartlett-pulse/lib/main.js +169 -0
- package/iter/bartlett-pulse/lib/validate.js +97 -0
- package/iter/bartlett-pulse/package.json +72 -0
- package/iter/cosine-wave/README.md +292 -0
- package/iter/cosine-wave/docs/img/equation_cosine_waveform.svg +55 -0
- package/iter/cosine-wave/docs/repl.txt +51 -0
- package/iter/cosine-wave/docs/types/index.d.ts +96 -0
- package/iter/cosine-wave/docs/types/test.ts +78 -0
- package/iter/cosine-wave/lib/index.js +54 -0
- package/iter/cosine-wave/lib/main.js +156 -0
- package/iter/cosine-wave/lib/validate.js +90 -0
- package/iter/cosine-wave/package.json +70 -0
- package/iter/dirac-comb/README.md +278 -0
- package/iter/dirac-comb/docs/img/equation_dirac_comb.svg +44 -0
- package/iter/dirac-comb/docs/repl.txt +48 -0
- package/iter/dirac-comb/docs/types/index.d.ts +89 -0
- package/iter/dirac-comb/docs/types/test.ts +78 -0
- package/iter/dirac-comb/lib/index.js +54 -0
- package/iter/dirac-comb/lib/main.js +152 -0
- package/iter/dirac-comb/lib/validate.js +82 -0
- package/iter/dirac-comb/package.json +72 -0
- package/iter/docs/types/index.d.ts +678 -0
- package/iter/docs/types/test.ts +29 -0
- package/iter/flat-top-pulse/README.md +330 -0
- package/iter/flat-top-pulse/docs/img/equation_flat_top_pulse_waveform.svg +177 -0
- package/iter/flat-top-pulse/docs/repl.txt +54 -0
- package/iter/flat-top-pulse/docs/types/index.d.ts +105 -0
- package/iter/flat-top-pulse/docs/types/test.ts +89 -0
- package/iter/flat-top-pulse/lib/index.js +54 -0
- package/iter/flat-top-pulse/lib/main.js +193 -0
- package/iter/flat-top-pulse/lib/validate.js +97 -0
- package/iter/flat-top-pulse/package.json +71 -0
- package/iter/hann-pulse/README.md +328 -0
- package/iter/hann-pulse/docs/img/equation_hann_pulse_waveform.svg +129 -0
- package/iter/hann-pulse/docs/repl.txt +54 -0
- package/iter/hann-pulse/docs/types/index.d.ts +105 -0
- package/iter/hann-pulse/docs/types/test.ts +89 -0
- package/iter/hann-pulse/lib/index.js +54 -0
- package/iter/hann-pulse/lib/main.js +171 -0
- package/iter/hann-pulse/lib/validate.js +97 -0
- package/iter/hann-pulse/package.json +72 -0
- package/iter/lanczos-pulse/README.md +325 -0
- package/iter/lanczos-pulse/docs/img/equation_lanczos_pulse_waveform.svg +122 -0
- package/iter/lanczos-pulse/docs/repl.txt +54 -0
- package/iter/lanczos-pulse/docs/types/index.d.ts +105 -0
- package/iter/lanczos-pulse/docs/types/test.ts +89 -0
- package/iter/lanczos-pulse/lib/index.js +54 -0
- package/iter/lanczos-pulse/lib/main.js +169 -0
- package/iter/lanczos-pulse/lib/validate.js +97 -0
- package/iter/lanczos-pulse/package.json +70 -0
- package/iter/lib/index.js +186 -0
- package/iter/package.json +63 -0
- package/iter/periodic-sinc/README.md +301 -0
- package/iter/periodic-sinc/docs/img/equation_periodic_sinc.svg +146 -0
- package/iter/periodic-sinc/docs/img/equation_periodic_sinc_in_terms_of_period.svg +164 -0
- package/iter/periodic-sinc/docs/img/equation_periodic_sinc_in_terms_of_sinc_function.svg +65 -0
- package/iter/periodic-sinc/docs/img/equation_periodic_sinc_substitution_even.svg +34 -0
- package/iter/periodic-sinc/docs/img/equation_periodic_sinc_substitution_odd.svg +34 -0
- package/iter/periodic-sinc/docs/repl.txt +54 -0
- package/iter/periodic-sinc/docs/types/index.d.ts +98 -0
- package/iter/periodic-sinc/docs/types/test.ts +102 -0
- package/iter/periodic-sinc/lib/index.js +50 -0
- package/iter/periodic-sinc/lib/main.js +241 -0
- package/iter/periodic-sinc/lib/validate.js +90 -0
- package/iter/periodic-sinc/package.json +70 -0
- package/iter/pulse/README.md +322 -0
- package/iter/pulse/docs/img/equation_pulse_waveform.svg +115 -0
- package/iter/pulse/docs/repl.txt +58 -0
- package/iter/pulse/docs/types/index.d.ts +109 -0
- package/iter/pulse/docs/types/test.ts +100 -0
- package/iter/pulse/lib/index.js +54 -0
- package/iter/pulse/lib/main.js +165 -0
- package/iter/pulse/lib/validate.js +105 -0
- package/iter/pulse/package.json +69 -0
- package/iter/sawtooth-wave/README.md +289 -0
- package/iter/sawtooth-wave/docs/img/equation_sawtooth_waveform.svg +73 -0
- package/iter/sawtooth-wave/docs/repl.txt +51 -0
- package/iter/sawtooth-wave/docs/types/index.d.ts +96 -0
- package/iter/sawtooth-wave/docs/types/test.ts +78 -0
- package/iter/sawtooth-wave/lib/index.js +54 -0
- package/iter/sawtooth-wave/lib/main.js +161 -0
- package/iter/sawtooth-wave/lib/validate.js +90 -0
- package/iter/sawtooth-wave/package.json +67 -0
- package/iter/sine-wave/README.md +292 -0
- package/iter/sine-wave/docs/img/equation_sine_waveform.svg +55 -0
- package/iter/sine-wave/docs/repl.txt +51 -0
- package/iter/sine-wave/docs/types/index.d.ts +96 -0
- package/iter/sine-wave/docs/types/test.ts +78 -0
- package/iter/sine-wave/lib/index.js +54 -0
- package/iter/sine-wave/lib/main.js +156 -0
- package/iter/sine-wave/lib/validate.js +90 -0
- package/iter/sine-wave/package.json +70 -0
- package/iter/square-wave/README.md +291 -0
- package/iter/square-wave/docs/img/equation_square_waveform.svg +115 -0
- package/iter/square-wave/docs/repl.txt +55 -0
- package/iter/square-wave/docs/types/index.d.ts +105 -0
- package/iter/square-wave/docs/types/test.ts +89 -0
- package/iter/square-wave/lib/index.js +54 -0
- package/iter/square-wave/lib/main.js +156 -0
- package/iter/square-wave/lib/validate.js +99 -0
- package/iter/square-wave/package.json +67 -0
- package/iter/triangle-wave/README.md +289 -0
- package/iter/triangle-wave/docs/img/equation_triangle_waveform.svg +75 -0
- package/iter/triangle-wave/docs/repl.txt +51 -0
- package/iter/triangle-wave/docs/types/index.d.ts +96 -0
- package/iter/triangle-wave/docs/types/test.ts +78 -0
- package/iter/triangle-wave/lib/index.js +54 -0
- package/iter/triangle-wave/lib/main.js +160 -0
- package/iter/triangle-wave/lib/validate.js +90 -0
- package/iter/triangle-wave/package.json +66 -0
- package/lib/index.js +51 -0
- package/package.json +72 -0
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Apache-2.0
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2019 The Stdlib Authors.
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
'use strict';
|
|
20
|
+
|
|
21
|
+
// MODULES //
|
|
22
|
+
|
|
23
|
+
var setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' );
|
|
24
|
+
var iteratorSymbol = require( '@stdlib/symbol/iterator' );
|
|
25
|
+
var cospi = require( '@stdlib/math/base/special/cospi' );
|
|
26
|
+
var validate = require( './validate.js' );
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
// MAIN //
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Returns an iterator which generates a cosine wave.
|
|
33
|
+
*
|
|
34
|
+
* @param {Options} [options] - function options
|
|
35
|
+
* @param {PositiveInteger} [options.period=10] - number of iterations before a cosine wave repeats
|
|
36
|
+
* @param {NonNegativeNumber} [options.amplitude=1.0] - peak amplitude
|
|
37
|
+
* @param {integer} [options.offset=0] - phase offset (in units of iterations; zero-based)
|
|
38
|
+
* @param {NonNegativeInteger} [options.iter=1e308] - number of iterations
|
|
39
|
+
* @throws {TypeError} options argument must be an object
|
|
40
|
+
* @throws {TypeError} must provide valid options
|
|
41
|
+
* @returns {Iterator} iterator
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* var opts = {
|
|
45
|
+
* 'period': 4
|
|
46
|
+
* };
|
|
47
|
+
*
|
|
48
|
+
* var iter = iterCosineWave( opts );
|
|
49
|
+
*
|
|
50
|
+
* var v = iter.next().value;
|
|
51
|
+
* // returns 1.0
|
|
52
|
+
*
|
|
53
|
+
* v = iter.next().value;
|
|
54
|
+
* // returns 0.0
|
|
55
|
+
*
|
|
56
|
+
* v = iter.next().value;
|
|
57
|
+
* // returns -1.0
|
|
58
|
+
*
|
|
59
|
+
* // ...
|
|
60
|
+
*/
|
|
61
|
+
function iterCosineWave( options ) {
|
|
62
|
+
var opts;
|
|
63
|
+
var iter;
|
|
64
|
+
var FLG;
|
|
65
|
+
var err;
|
|
66
|
+
var t;
|
|
67
|
+
var s;
|
|
68
|
+
var i;
|
|
69
|
+
|
|
70
|
+
opts = {
|
|
71
|
+
'period': 10,
|
|
72
|
+
'amplitude': 1.0,
|
|
73
|
+
'offset': 0,
|
|
74
|
+
'iter': 1e308
|
|
75
|
+
};
|
|
76
|
+
if ( arguments.length ) {
|
|
77
|
+
err = validate( opts, options );
|
|
78
|
+
if ( err ) {
|
|
79
|
+
throw err;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
t = ( opts.period-opts.offset ) % opts.period;
|
|
83
|
+
if ( t < 0 ) {
|
|
84
|
+
t += opts.period; // normalize such that t ϵ [0,τ]
|
|
85
|
+
}
|
|
86
|
+
t -= 1;
|
|
87
|
+
s = 2.0 / opts.period;
|
|
88
|
+
i = 0;
|
|
89
|
+
|
|
90
|
+
// Create an iterator protocol-compliant object:
|
|
91
|
+
iter = {};
|
|
92
|
+
setReadOnly( iter, 'next', next );
|
|
93
|
+
setReadOnly( iter, 'return', end );
|
|
94
|
+
|
|
95
|
+
// If an environment supports `Symbol.iterator`, make the iterator iterable:
|
|
96
|
+
if ( iteratorSymbol ) {
|
|
97
|
+
setReadOnly( iter, iteratorSymbol, factory );
|
|
98
|
+
}
|
|
99
|
+
return iter;
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Returns an iterator protocol-compliant object containing the next iterated value.
|
|
103
|
+
*
|
|
104
|
+
* @private
|
|
105
|
+
* @returns {Object} iterator protocol-compliant object
|
|
106
|
+
*/
|
|
107
|
+
function next() {
|
|
108
|
+
i += 1;
|
|
109
|
+
if ( FLG || i > opts.iter ) {
|
|
110
|
+
return {
|
|
111
|
+
'done': true
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
t += 1;
|
|
115
|
+
t %= opts.period;
|
|
116
|
+
return {
|
|
117
|
+
'value': opts.amplitude * cospi( s*t ),
|
|
118
|
+
'done': false
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Finishes an iterator.
|
|
124
|
+
*
|
|
125
|
+
* @private
|
|
126
|
+
* @param {*} [value] - value to return
|
|
127
|
+
* @returns {Object} iterator protocol-compliant object
|
|
128
|
+
*/
|
|
129
|
+
function end( value ) {
|
|
130
|
+
FLG = true;
|
|
131
|
+
if ( arguments.length ) {
|
|
132
|
+
return {
|
|
133
|
+
'value': value,
|
|
134
|
+
'done': true
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
return {
|
|
138
|
+
'done': true
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Returns a new iterator.
|
|
144
|
+
*
|
|
145
|
+
* @private
|
|
146
|
+
* @returns {Iterator} iterator
|
|
147
|
+
*/
|
|
148
|
+
function factory() {
|
|
149
|
+
return iterCosineWave( opts );
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
// EXPORTS //
|
|
155
|
+
|
|
156
|
+
module.exports = iterCosineWave;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Apache-2.0
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2019 The Stdlib Authors.
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
'use strict';
|
|
20
|
+
|
|
21
|
+
// MODULES //
|
|
22
|
+
|
|
23
|
+
var isPlainObject = require( '@stdlib/assert/is-plain-object' );
|
|
24
|
+
var hasOwnProp = require( '@stdlib/assert/has-own-property' );
|
|
25
|
+
var isInteger = require( '@stdlib/assert/is-integer' ).isPrimitive;
|
|
26
|
+
var isPositiveInteger = require( '@stdlib/assert/is-positive-integer' ).isPrimitive;
|
|
27
|
+
var isNonNegativeInteger = require( '@stdlib/assert/is-nonnegative-integer' ).isPrimitive;
|
|
28
|
+
var isNonNegativeNumber = require( '@stdlib/assert/is-nonnegative-number' ).isPrimitive;
|
|
29
|
+
var format = require( '@stdlib/string/format' );
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
// MAIN //
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Validates function options.
|
|
36
|
+
*
|
|
37
|
+
* @private
|
|
38
|
+
* @param {Object} opts - destination object
|
|
39
|
+
* @param {Options} options - function options
|
|
40
|
+
* @param {PositiveInteger} [options.period] - number of iterations before a cosine wave repeats
|
|
41
|
+
* @param {NonNegativeNumber} [options.amplitude] - peak amplitude
|
|
42
|
+
* @param {integer} [options.offset] - phase offset (in units of iterations)
|
|
43
|
+
* @param {NonNegativeInteger} [options.iter] - number of iterations
|
|
44
|
+
* @returns {(Error|null)} null or an error object
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* var opts = {};
|
|
48
|
+
* var options = {
|
|
49
|
+
* 'iter': 100
|
|
50
|
+
* };
|
|
51
|
+
* var err = validate( opts, options );
|
|
52
|
+
* if ( err ) {
|
|
53
|
+
* throw err;
|
|
54
|
+
* }
|
|
55
|
+
*/
|
|
56
|
+
function validate( opts, options ) {
|
|
57
|
+
if ( !isPlainObject( options ) ) {
|
|
58
|
+
return new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) );
|
|
59
|
+
}
|
|
60
|
+
if ( hasOwnProp( options, 'period' ) ) {
|
|
61
|
+
opts.period = options.period;
|
|
62
|
+
if ( !isPositiveInteger( options.period ) ) {
|
|
63
|
+
return new TypeError( format( 'invalid option. `%s` option must be an positive integer. Option: `%s`.', 'period', options.period ) );
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
if ( hasOwnProp( options, 'amplitude' ) ) {
|
|
67
|
+
opts.amplitude = options.amplitude;
|
|
68
|
+
if ( !isNonNegativeNumber( options.amplitude ) ) {
|
|
69
|
+
return new TypeError( format( 'invalid option. `%s` option must be a nonnegative number. Option: `%s`.', 'amplitude', options.amplitude ) );
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
if ( hasOwnProp( options, 'offset' ) ) {
|
|
73
|
+
opts.offset = options.offset;
|
|
74
|
+
if ( !isInteger( options.offset ) ) {
|
|
75
|
+
return new TypeError( format( 'invalid option. `%s` option must be an integer. Option: `%s`.', 'offset', options.offset ) );
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
if ( hasOwnProp( options, 'iter' ) ) {
|
|
79
|
+
opts.iter = options.iter;
|
|
80
|
+
if ( !isNonNegativeInteger( options.iter ) ) {
|
|
81
|
+
return new TypeError( format( 'invalid option. `%s` option must be a nonnegative integer. Option: `%s`.', 'iter', options.iter ) );
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return null;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
// EXPORTS //
|
|
89
|
+
|
|
90
|
+
module.exports = validate;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@stdlib/simulate/iter/cosine-wave",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"description": "Create an iterator which generates a cosine wave.",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"author": {
|
|
7
|
+
"name": "The Stdlib Authors",
|
|
8
|
+
"url": "https://github.com/stdlib-js/stdlib/graphs/contributors"
|
|
9
|
+
},
|
|
10
|
+
"contributors": [
|
|
11
|
+
{
|
|
12
|
+
"name": "The Stdlib Authors",
|
|
13
|
+
"url": "https://github.com/stdlib-js/stdlib/graphs/contributors"
|
|
14
|
+
}
|
|
15
|
+
],
|
|
16
|
+
"main": "./lib",
|
|
17
|
+
"directories": {
|
|
18
|
+
"benchmark": "./benchmark",
|
|
19
|
+
"doc": "./docs",
|
|
20
|
+
"example": "./examples",
|
|
21
|
+
"lib": "./lib",
|
|
22
|
+
"test": "./test"
|
|
23
|
+
},
|
|
24
|
+
"types": "./docs/types",
|
|
25
|
+
"scripts": {},
|
|
26
|
+
"homepage": "https://github.com/stdlib-js/stdlib",
|
|
27
|
+
"repository": {
|
|
28
|
+
"type": "git",
|
|
29
|
+
"url": "git://github.com/stdlib-js/stdlib.git"
|
|
30
|
+
},
|
|
31
|
+
"bugs": {
|
|
32
|
+
"url": "https://github.com/stdlib-js/stdlib/issues"
|
|
33
|
+
},
|
|
34
|
+
"dependencies": {},
|
|
35
|
+
"devDependencies": {},
|
|
36
|
+
"engines": {
|
|
37
|
+
"node": ">=0.10.0",
|
|
38
|
+
"npm": ">2.7.0"
|
|
39
|
+
},
|
|
40
|
+
"os": [
|
|
41
|
+
"aix",
|
|
42
|
+
"darwin",
|
|
43
|
+
"freebsd",
|
|
44
|
+
"linux",
|
|
45
|
+
"macos",
|
|
46
|
+
"openbsd",
|
|
47
|
+
"sunos",
|
|
48
|
+
"win32",
|
|
49
|
+
"windows"
|
|
50
|
+
],
|
|
51
|
+
"keywords": [
|
|
52
|
+
"stdlib",
|
|
53
|
+
"simulate",
|
|
54
|
+
"simulation",
|
|
55
|
+
"sine",
|
|
56
|
+
"sin",
|
|
57
|
+
"cos",
|
|
58
|
+
"cosine",
|
|
59
|
+
"sinusoid",
|
|
60
|
+
"wave",
|
|
61
|
+
"signal",
|
|
62
|
+
"processing",
|
|
63
|
+
"waveform",
|
|
64
|
+
"periodic",
|
|
65
|
+
"iterator",
|
|
66
|
+
"iterate",
|
|
67
|
+
"iteration",
|
|
68
|
+
"iter"
|
|
69
|
+
]
|
|
70
|
+
}
|
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
|
|
3
|
+
@license Apache-2.0
|
|
4
|
+
|
|
5
|
+
Copyright (c) 2019 The Stdlib Authors.
|
|
6
|
+
|
|
7
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
you may not use this file except in compliance with the License.
|
|
9
|
+
You may obtain a copy of the License at
|
|
10
|
+
|
|
11
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
|
|
13
|
+
Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
See the License for the specific language governing permissions and
|
|
17
|
+
limitations under the License.
|
|
18
|
+
|
|
19
|
+
-->
|
|
20
|
+
|
|
21
|
+
# iterDiracComb
|
|
22
|
+
|
|
23
|
+
> Create an iterator which generates a Dirac comb.
|
|
24
|
+
|
|
25
|
+
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
|
|
26
|
+
|
|
27
|
+
<section class="intro">
|
|
28
|
+
|
|
29
|
+
A Dirac comb is represented by the following equation
|
|
30
|
+
|
|
31
|
+
<!-- <equation class="equation" label="eq:dirac_comb" align="center" raw="f(t; T, \varphi) = \delta((t-\varphi) \bmod T)" alt="Equation for a Dirac comb."> -->
|
|
32
|
+
|
|
33
|
+
<div class="equation" align="center" data-raw-text="f(t; T, \varphi) = \delta((t-\varphi) \bmod T)" data-equation="eq:dirac_comb">
|
|
34
|
+
<img src="https://cdn.jsdelivr.net/gh/stdlib-js/stdlib@801be3f8c35f2e79fbcf9b6e38568479f6faa5f2/lib/node_modules/@stdlib/simulate/iter/dirac-comb/docs/img/equation_dirac_comb.svg" alt="Equation for a Dirac comb.">
|
|
35
|
+
<br>
|
|
36
|
+
</div>
|
|
37
|
+
|
|
38
|
+
<!-- </equation> -->
|
|
39
|
+
|
|
40
|
+
where `δ` is the Dirac delta function, `T` is the period, and `φ` is the phase offset.
|
|
41
|
+
|
|
42
|
+
<!-- TODO: add a figure showing a Dirac comb -->
|
|
43
|
+
|
|
44
|
+
</section>
|
|
45
|
+
|
|
46
|
+
<!-- /.intro -->
|
|
47
|
+
|
|
48
|
+
<!-- Package usage documentation. -->
|
|
49
|
+
|
|
50
|
+
<section class="usage">
|
|
51
|
+
|
|
52
|
+
## Usage
|
|
53
|
+
|
|
54
|
+
```javascript
|
|
55
|
+
var iterDiracComb = require( '@stdlib/simulate/iter/dirac-comb' );
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
#### iterDiracComb( \[options] )
|
|
59
|
+
|
|
60
|
+
Returns an iterator which generates a Dirac comb.
|
|
61
|
+
|
|
62
|
+
```javascript
|
|
63
|
+
var it = iterDiracComb();
|
|
64
|
+
// returns <Object>
|
|
65
|
+
|
|
66
|
+
var v = it.next().value;
|
|
67
|
+
// returns Infinity
|
|
68
|
+
|
|
69
|
+
v = it.next().value;
|
|
70
|
+
// returns 0.0
|
|
71
|
+
|
|
72
|
+
v = it.next().value;
|
|
73
|
+
// returns 0.0
|
|
74
|
+
|
|
75
|
+
// ...
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
The returned iterator protocol-compliant object has the following properties:
|
|
79
|
+
|
|
80
|
+
- **next**: function which returns an iterator protocol-compliant object containing the next iterated value (if one exists) assigned to a `value` property and a `done` property having a `boolean` value indicating whether the iterator is finished.
|
|
81
|
+
- **return**: function which closes an iterator and returns a single (optional) argument in an iterator protocol-compliant object.
|
|
82
|
+
|
|
83
|
+
The function supports the following `options`:
|
|
84
|
+
|
|
85
|
+
- **period**: period (i.e., the number of iterations before a waveform repeats). Default: `10`.
|
|
86
|
+
- **offset**: phase offset (in units of iterations; zero-based). A negative offset translates a waveform to the left. A positive offset translates a waveform to the right. Default: `0`.
|
|
87
|
+
- **iter**: number of iterations. Default: `1e308`.
|
|
88
|
+
|
|
89
|
+
By default, the function returns an iterator which generates a Dirac delta function that repeats every `10` iterations. To specify an alternative period, set the `period` option.
|
|
90
|
+
|
|
91
|
+
```javascript
|
|
92
|
+
var opts = {
|
|
93
|
+
'period': 4
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
var it = iterDiracComb( opts );
|
|
97
|
+
// returns <Object>
|
|
98
|
+
|
|
99
|
+
var v = it.next().value;
|
|
100
|
+
// returns Infinity
|
|
101
|
+
|
|
102
|
+
v = it.next().value;
|
|
103
|
+
// returns 0.0
|
|
104
|
+
|
|
105
|
+
v = it.next().value;
|
|
106
|
+
// returns 0.0
|
|
107
|
+
|
|
108
|
+
v = it.next().value;
|
|
109
|
+
// returns 0.0
|
|
110
|
+
|
|
111
|
+
v = it.next().value;
|
|
112
|
+
// returns Infinity
|
|
113
|
+
|
|
114
|
+
// ...
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
To adjust at what point the iterator begins in the waveform cycle, set the phase `offset` option. For example, to translate the waveform to the left,
|
|
118
|
+
|
|
119
|
+
```javascript
|
|
120
|
+
var opts = {
|
|
121
|
+
'period': 4,
|
|
122
|
+
'offset': -1
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
var it = iterDiracComb( opts );
|
|
126
|
+
// returns <Object>
|
|
127
|
+
|
|
128
|
+
var v = it.next().value;
|
|
129
|
+
// returns 0.0
|
|
130
|
+
|
|
131
|
+
v = it.next().value;
|
|
132
|
+
// returns 0.0
|
|
133
|
+
|
|
134
|
+
v = it.next().value;
|
|
135
|
+
// returns 0.0
|
|
136
|
+
|
|
137
|
+
v = it.next().value;
|
|
138
|
+
// returns Infinity
|
|
139
|
+
|
|
140
|
+
v = it.next().value;
|
|
141
|
+
// returns 0.0
|
|
142
|
+
|
|
143
|
+
// ...
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
To translate the waveform to the right,
|
|
147
|
+
|
|
148
|
+
```javascript
|
|
149
|
+
var opts = {
|
|
150
|
+
'period': 4,
|
|
151
|
+
'offset': 1
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
var it = iterDiracComb( opts );
|
|
155
|
+
// returns <Object>
|
|
156
|
+
|
|
157
|
+
var v = it.next().value;
|
|
158
|
+
// returns 0.0
|
|
159
|
+
|
|
160
|
+
v = it.next().value;
|
|
161
|
+
// returns Infinity
|
|
162
|
+
|
|
163
|
+
v = it.next().value;
|
|
164
|
+
// returns 0.0
|
|
165
|
+
|
|
166
|
+
v = it.next().value;
|
|
167
|
+
// returns 0.0
|
|
168
|
+
|
|
169
|
+
v = it.next().value;
|
|
170
|
+
// returns 0.0
|
|
171
|
+
|
|
172
|
+
// ...
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
By default, the function returns an infinite iterator (i.e., an iterator which never ends). To limit the number of iterations, set the `iter` option.
|
|
176
|
+
|
|
177
|
+
```javascript
|
|
178
|
+
var opts = {
|
|
179
|
+
'iter': 2
|
|
180
|
+
};
|
|
181
|
+
var it = iterDiracComb( opts );
|
|
182
|
+
// returns <Object>
|
|
183
|
+
|
|
184
|
+
var v = it.next().value;
|
|
185
|
+
// returns Infinity
|
|
186
|
+
|
|
187
|
+
v = it.next().value;
|
|
188
|
+
// returns 0.0
|
|
189
|
+
|
|
190
|
+
var bool = it.next().done;
|
|
191
|
+
// returns true
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
</section>
|
|
195
|
+
|
|
196
|
+
<!-- /.usage -->
|
|
197
|
+
|
|
198
|
+
<!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
|
|
199
|
+
|
|
200
|
+
<section class="notes">
|
|
201
|
+
|
|
202
|
+
## Notes
|
|
203
|
+
|
|
204
|
+
- If an environment supports `Symbol.iterator`, the returned iterator is iterable.
|
|
205
|
+
|
|
206
|
+
</section>
|
|
207
|
+
|
|
208
|
+
<!-- /.notes -->
|
|
209
|
+
|
|
210
|
+
<!-- Package usage examples. -->
|
|
211
|
+
|
|
212
|
+
<section class="examples">
|
|
213
|
+
|
|
214
|
+
## Examples
|
|
215
|
+
|
|
216
|
+
<!-- eslint no-undef: "error" -->
|
|
217
|
+
|
|
218
|
+
```javascript
|
|
219
|
+
var iterDiracComb = require( '@stdlib/simulate/iter/dirac-comb' );
|
|
220
|
+
|
|
221
|
+
// Create an iterator:
|
|
222
|
+
var opts = {
|
|
223
|
+
'period': 10,
|
|
224
|
+
'offset': -5,
|
|
225
|
+
'iter': 100
|
|
226
|
+
};
|
|
227
|
+
var it = iterDiracComb( opts );
|
|
228
|
+
|
|
229
|
+
// Perform manual iteration...
|
|
230
|
+
var v;
|
|
231
|
+
while ( true ) {
|
|
232
|
+
v = it.next();
|
|
233
|
+
if ( v.done ) {
|
|
234
|
+
break;
|
|
235
|
+
}
|
|
236
|
+
console.log( v.value );
|
|
237
|
+
}
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
</section>
|
|
241
|
+
|
|
242
|
+
<!-- /.examples -->
|
|
243
|
+
|
|
244
|
+
<!-- Section to include cited references. If references are included, add a horizontal rule *before* the section. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
|
|
245
|
+
|
|
246
|
+
<section class="references">
|
|
247
|
+
|
|
248
|
+
</section>
|
|
249
|
+
|
|
250
|
+
<!-- /.references -->
|
|
251
|
+
|
|
252
|
+
<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
|
|
253
|
+
|
|
254
|
+
<section class="related">
|
|
255
|
+
|
|
256
|
+
* * *
|
|
257
|
+
|
|
258
|
+
## See Also
|
|
259
|
+
|
|
260
|
+
- <span class="package-name">[`@stdlib/simulate/iter/pulse`][@stdlib/simulate/iter/pulse]</span><span class="delimiter">: </span><span class="description">create an iterator which generates a pulse waveform.</span>
|
|
261
|
+
|
|
262
|
+
</section>
|
|
263
|
+
|
|
264
|
+
<!-- /.related -->
|
|
265
|
+
|
|
266
|
+
<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
|
|
267
|
+
|
|
268
|
+
<section class="links">
|
|
269
|
+
|
|
270
|
+
<!-- <related-links> -->
|
|
271
|
+
|
|
272
|
+
[@stdlib/simulate/iter/pulse]: https://github.com/stdlib-js/simulate/tree/main/iter/pulse
|
|
273
|
+
|
|
274
|
+
<!-- </related-links> -->
|
|
275
|
+
|
|
276
|
+
</section>
|
|
277
|
+
|
|
278
|
+
<!-- /.links -->
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
<svg xmlns:xlink="http://www.w3.org/1999/xlink" width="29.435ex" height="2.843ex" style="vertical-align: -0.838ex;" viewBox="0 -863.1 12673.4 1223.9" role="img" focusable="false" xmlns="http://www.w3.org/2000/svg" aria-labelledby="MathJax-SVG-1-Title">
|
|
2
|
+
<title id="MathJax-SVG-1-Title">f left-parenthesis t semicolon upper T comma phi right-parenthesis equals delta left-parenthesis left-parenthesis t minus phi right-parenthesis mod upper T right-parenthesis</title>
|
|
3
|
+
<defs aria-hidden="true">
|
|
4
|
+
<path stroke-width="1" id="E1-MJMATHI-66" d="M118 -162Q120 -162 124 -164T135 -167T147 -168Q160 -168 171 -155T187 -126Q197 -99 221 27T267 267T289 382V385H242Q195 385 192 387Q188 390 188 397L195 425Q197 430 203 430T250 431Q298 431 298 432Q298 434 307 482T319 540Q356 705 465 705Q502 703 526 683T550 630Q550 594 529 578T487 561Q443 561 443 603Q443 622 454 636T478 657L487 662Q471 668 457 668Q445 668 434 658T419 630Q412 601 403 552T387 469T380 433Q380 431 435 431Q480 431 487 430T498 424Q499 420 496 407T491 391Q489 386 482 386T428 385H372L349 263Q301 15 282 -47Q255 -132 212 -173Q175 -205 139 -205Q107 -205 81 -186T55 -132Q55 -95 76 -78T118 -61Q162 -61 162 -103Q162 -122 151 -136T127 -157L118 -162Z"></path>
|
|
5
|
+
<path stroke-width="1" id="E1-MJMAIN-28" d="M94 250Q94 319 104 381T127 488T164 576T202 643T244 695T277 729T302 750H315H319Q333 750 333 741Q333 738 316 720T275 667T226 581T184 443T167 250T184 58T225 -81T274 -167T316 -220T333 -241Q333 -250 318 -250H315H302L274 -226Q180 -141 137 -14T94 250Z"></path>
|
|
6
|
+
<path stroke-width="1" id="E1-MJMATHI-74" d="M26 385Q19 392 19 395Q19 399 22 411T27 425Q29 430 36 430T87 431H140L159 511Q162 522 166 540T173 566T179 586T187 603T197 615T211 624T229 626Q247 625 254 615T261 596Q261 589 252 549T232 470L222 433Q222 431 272 431H323Q330 424 330 420Q330 398 317 385H210L174 240Q135 80 135 68Q135 26 162 26Q197 26 230 60T283 144Q285 150 288 151T303 153H307Q322 153 322 145Q322 142 319 133Q314 117 301 95T267 48T216 6T155 -11Q125 -11 98 4T59 56Q57 64 57 83V101L92 241Q127 382 128 383Q128 385 77 385H26Z"></path>
|
|
7
|
+
<path stroke-width="1" id="E1-MJMAIN-3B" d="M78 370Q78 394 95 412T138 430Q162 430 180 414T199 371Q199 346 182 328T139 310T96 327T78 370ZM78 60Q78 85 94 103T137 121Q202 121 202 8Q202 -44 183 -94T144 -169T118 -194Q115 -194 106 -186T95 -174Q94 -171 107 -155T137 -107T160 -38Q161 -32 162 -22T165 -4T165 4Q165 5 161 4T142 0Q110 0 94 18T78 60Z"></path>
|
|
8
|
+
<path stroke-width="1" id="E1-MJMATHI-54" d="M40 437Q21 437 21 445Q21 450 37 501T71 602L88 651Q93 669 101 677H569H659Q691 677 697 676T704 667Q704 661 687 553T668 444Q668 437 649 437Q640 437 637 437T631 442L629 445Q629 451 635 490T641 551Q641 586 628 604T573 629Q568 630 515 631Q469 631 457 630T439 622Q438 621 368 343T298 60Q298 48 386 46Q418 46 427 45T436 36Q436 31 433 22Q429 4 424 1L422 0Q419 0 415 0Q410 0 363 1T228 2Q99 2 64 0H49Q43 6 43 9T45 27Q49 40 55 46H83H94Q174 46 189 55Q190 56 191 56Q196 59 201 76T241 233Q258 301 269 344Q339 619 339 625Q339 630 310 630H279Q212 630 191 624Q146 614 121 583T67 467Q60 445 57 441T43 437H40Z"></path>
|
|
9
|
+
<path stroke-width="1" id="E1-MJMAIN-2C" d="M78 35T78 60T94 103T137 121Q165 121 187 96T210 8Q210 -27 201 -60T180 -117T154 -158T130 -185T117 -194Q113 -194 104 -185T95 -172Q95 -168 106 -156T131 -126T157 -76T173 -3V9L172 8Q170 7 167 6T161 3T152 1T140 0Q113 0 96 17Z"></path>
|
|
10
|
+
<path stroke-width="1" id="E1-MJMATHI-3C6" d="M92 210Q92 176 106 149T142 108T185 85T220 72L235 70L237 71L250 112Q268 170 283 211T322 299T370 375T429 423T502 442Q547 442 582 410T618 302Q618 224 575 152T457 35T299 -10Q273 -10 273 -12L266 -48Q260 -83 252 -125T241 -179Q236 -203 215 -212Q204 -218 190 -218Q159 -215 159 -185Q159 -175 214 -2L209 0Q204 2 195 5T173 14T147 28T120 46T94 71T71 103T56 142T50 190Q50 238 76 311T149 431H162Q183 431 183 423Q183 417 175 409Q134 361 114 300T92 210ZM574 278Q574 320 550 344T486 369Q437 369 394 329T323 218Q309 184 295 109L286 64Q304 62 306 62Q423 62 498 131T574 278Z"></path>
|
|
11
|
+
<path stroke-width="1" id="E1-MJMAIN-29" d="M60 749L64 750Q69 750 74 750H86L114 726Q208 641 251 514T294 250Q294 182 284 119T261 12T224 -76T186 -143T145 -194T113 -227T90 -246Q87 -249 86 -250H74Q66 -250 63 -250T58 -247T55 -238Q56 -237 66 -225Q221 -64 221 250T66 725Q56 737 55 738Q55 746 60 749Z"></path>
|
|
12
|
+
<path stroke-width="1" id="E1-MJMAIN-3D" d="M56 347Q56 360 70 367H707Q722 359 722 347Q722 336 708 328L390 327H72Q56 332 56 347ZM56 153Q56 168 72 173H708Q722 163 722 153Q722 140 707 133H70Q56 140 56 153Z"></path>
|
|
13
|
+
<path stroke-width="1" id="E1-MJMATHI-3B4" d="M195 609Q195 656 227 686T302 717Q319 716 351 709T407 697T433 690Q451 682 451 662Q451 644 438 628T403 612Q382 612 348 641T288 671T249 657T235 628Q235 584 334 463Q401 379 401 292Q401 169 340 80T205 -10H198Q127 -10 83 36T36 153Q36 286 151 382Q191 413 252 434Q252 435 245 449T230 481T214 521T201 566T195 609ZM112 130Q112 83 136 55T204 27Q233 27 256 51T291 111T309 178T316 232Q316 267 309 298T295 344T269 400L259 396Q215 381 183 342T137 256T118 179T112 130Z"></path>
|
|
14
|
+
<path stroke-width="1" id="E1-MJMAIN-2212" d="M84 237T84 250T98 270H679Q694 262 694 250T679 230H98Q84 237 84 250Z"></path>
|
|
15
|
+
<path stroke-width="1" id="E1-MJMAIN-6D" d="M41 46H55Q94 46 102 60V68Q102 77 102 91T102 122T103 161T103 203Q103 234 103 269T102 328V351Q99 370 88 376T43 385H25V408Q25 431 27 431L37 432Q47 433 65 434T102 436Q119 437 138 438T167 441T178 442H181V402Q181 364 182 364T187 369T199 384T218 402T247 421T285 437Q305 442 336 442Q351 442 364 440T387 434T406 426T421 417T432 406T441 395T448 384T452 374T455 366L457 361L460 365Q463 369 466 373T475 384T488 397T503 410T523 422T546 432T572 439T603 442Q729 442 740 329Q741 322 741 190V104Q741 66 743 59T754 49Q775 46 803 46H819V0H811L788 1Q764 2 737 2T699 3Q596 3 587 0H579V46H595Q656 46 656 62Q657 64 657 200Q656 335 655 343Q649 371 635 385T611 402T585 404Q540 404 506 370Q479 343 472 315T464 232V168V108Q464 78 465 68T468 55T477 49Q498 46 526 46H542V0H534L510 1Q487 2 460 2T422 3Q319 3 310 0H302V46H318Q379 46 379 62Q380 64 380 200Q379 335 378 343Q372 371 358 385T334 402T308 404Q263 404 229 370Q202 343 195 315T187 232V168V108Q187 78 188 68T191 55T200 49Q221 46 249 46H265V0H257L234 1Q210 2 183 2T145 3Q42 3 33 0H25V46H41Z"></path>
|
|
16
|
+
<path stroke-width="1" id="E1-MJMAIN-6F" d="M28 214Q28 309 93 378T250 448Q340 448 405 380T471 215Q471 120 407 55T250 -10Q153 -10 91 57T28 214ZM250 30Q372 30 372 193V225V250Q372 272 371 288T364 326T348 362T317 390T268 410Q263 411 252 411Q222 411 195 399Q152 377 139 338T126 246V226Q126 130 145 91Q177 30 250 30Z"></path>
|
|
17
|
+
<path stroke-width="1" id="E1-MJMAIN-64" d="M376 495Q376 511 376 535T377 568Q377 613 367 624T316 637H298V660Q298 683 300 683L310 684Q320 685 339 686T376 688Q393 689 413 690T443 693T454 694H457V390Q457 84 458 81Q461 61 472 55T517 46H535V0Q533 0 459 -5T380 -11H373V44L365 37Q307 -11 235 -11Q158 -11 96 50T34 215Q34 315 97 378T244 442Q319 442 376 393V495ZM373 342Q328 405 260 405Q211 405 173 369Q146 341 139 305T131 211Q131 155 138 120T173 59Q203 26 251 26Q322 26 373 103V342Z"></path>
|
|
18
|
+
</defs>
|
|
19
|
+
<g stroke="currentColor" fill="currentColor" stroke-width="0" transform="matrix(1 0 0 -1 0 0)" aria-hidden="true">
|
|
20
|
+
<use xlink:href="#E1-MJMATHI-66" x="0" y="0"></use>
|
|
21
|
+
<use xlink:href="#E1-MJMAIN-28" x="550" y="0"></use>
|
|
22
|
+
<use xlink:href="#E1-MJMATHI-74" x="940" y="0"></use>
|
|
23
|
+
<use xlink:href="#E1-MJMAIN-3B" x="1301" y="0"></use>
|
|
24
|
+
<use xlink:href="#E1-MJMATHI-54" x="1746" y="0"></use>
|
|
25
|
+
<use xlink:href="#E1-MJMAIN-2C" x="2451" y="0"></use>
|
|
26
|
+
<use xlink:href="#E1-MJMATHI-3C6" x="2896" y="0"></use>
|
|
27
|
+
<use xlink:href="#E1-MJMAIN-29" x="3550" y="0"></use>
|
|
28
|
+
<use xlink:href="#E1-MJMAIN-3D" x="4218" y="0"></use>
|
|
29
|
+
<use xlink:href="#E1-MJMATHI-3B4" x="5274" y="0"></use>
|
|
30
|
+
<use xlink:href="#E1-MJMAIN-28" x="5725" y="0"></use>
|
|
31
|
+
<use xlink:href="#E1-MJMAIN-28" x="6115" y="0"></use>
|
|
32
|
+
<use xlink:href="#E1-MJMATHI-74" x="6504" y="0"></use>
|
|
33
|
+
<use xlink:href="#E1-MJMAIN-2212" x="7088" y="0"></use>
|
|
34
|
+
<use xlink:href="#E1-MJMATHI-3C6" x="8089" y="0"></use>
|
|
35
|
+
<use xlink:href="#E1-MJMAIN-29" x="8743" y="0"></use>
|
|
36
|
+
<g transform="translate(9411,0)">
|
|
37
|
+
<use xlink:href="#E1-MJMAIN-6D"></use>
|
|
38
|
+
<use xlink:href="#E1-MJMAIN-6F" x="833" y="0"></use>
|
|
39
|
+
<use xlink:href="#E1-MJMAIN-64" x="1334" y="0"></use>
|
|
40
|
+
</g>
|
|
41
|
+
<use xlink:href="#E1-MJMATHI-54" x="11579" y="0"></use>
|
|
42
|
+
<use xlink:href="#E1-MJMAIN-29" x="12283" y="0"></use>
|
|
43
|
+
</g>
|
|
44
|
+
</svg>
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
|
|
2
|
+
{{alias}}( [options] )
|
|
3
|
+
Returns an iterator which generates a Dirac comb.
|
|
4
|
+
|
|
5
|
+
If an environment supports Symbol.iterator, the returned iterator is
|
|
6
|
+
iterable.
|
|
7
|
+
|
|
8
|
+
Parameters
|
|
9
|
+
----------
|
|
10
|
+
options: Object (optional)
|
|
11
|
+
Function options.
|
|
12
|
+
|
|
13
|
+
options.period: integer (optional)
|
|
14
|
+
Period (i.e., the number of iterations before a waveform repeats).
|
|
15
|
+
Default: 10.
|
|
16
|
+
|
|
17
|
+
options.offset: integer (optional)
|
|
18
|
+
Phase offset (in units of iterations; zero-based). A negative offset
|
|
19
|
+
translates the waveform to the left. A positive offset translates a
|
|
20
|
+
waveform to the right. Default: 0.
|
|
21
|
+
|
|
22
|
+
options.iter: integer (optional)
|
|
23
|
+
Number of iterations. Default: 1e308.
|
|
24
|
+
|
|
25
|
+
Returns
|
|
26
|
+
-------
|
|
27
|
+
iterator: Object
|
|
28
|
+
Iterator.
|
|
29
|
+
|
|
30
|
+
iterator.next(): Function
|
|
31
|
+
Returns an iterator protocol-compliant object containing the next
|
|
32
|
+
iterated value (if one exists) and a boolean flag indicating whether the
|
|
33
|
+
iterator is finished.
|
|
34
|
+
|
|
35
|
+
iterator.return( [value] ): Function
|
|
36
|
+
Finishes an iterator and returns a provided value.
|
|
37
|
+
|
|
38
|
+
Examples
|
|
39
|
+
--------
|
|
40
|
+
> var it = {{alias}}();
|
|
41
|
+
> var v = it.next().value
|
|
42
|
+
Infinity
|
|
43
|
+
> v = it.next().value
|
|
44
|
+
0.0
|
|
45
|
+
|
|
46
|
+
See Also
|
|
47
|
+
--------
|
|
48
|
+
|