SignalProcessing
GenerateTone
generate a tone
Calling Sequence
Parameters
Options
Description
Thread Safety
Examples
Compatibility
GenerateTone( n, magnitude, frequency, phase )
n
-
posint, number of samples to generate
magnitude
realcons, magnitude of the signal
frequency
realcons, the frequency relative to the sampling frequency; with value 0 <= frequency < 1/2 (Nyquist sampling frequency)
phase
realcons, the phase of the signal (0 <= phase < 2Pi)
container : Array, predefined Array for holding results
The GenerateTone(n, magnitude, frequency, phase ) command generates n samples for a tone (sinusoidal) signal with the indicated values for the magnitude, frequency and phase. The result is returned in an Array with datatype float[8].
If the container=c option is provided, then the results are put into c and c is returned. With this option, no additional memory is allocated to store the result. The container must be an Array of size n having datatype float[8].
The SignalProcessing[GenerateTone] command is thread-safe as of Maple 17.
For more information on thread safety, see index/threadsafe.
with⁡SignalProcessing:
GenerateTone⁡10,1,1π,π
−1.0.4161468364414230.653643621350038−0.9601702863236710.1455000321309760.839071530285352−0.843853957257653−0.1367372214521720.957659481417870−0.660316704993773
The container option can be used to put generated values into a predefined Array.
c≔Array⁡1..10,datatype=float8,order=C_order:
GenerateTone⁡10,1,1π,π,container=c
c
SignalPlot⁡GenerateTone⁡100,1,1π,π
nSamples≔200:
RelativeFrequency≔0.02:
signal≔Array⁡GenerateTone⁡nSamples,1,RelativeFrequency,0
signal≔1.,0.992114701314478,0.968583161128631,0.929776485888252,0.876306680043864,0.809016994374948,0.728968627421413,0.637423989748692,0.535826794978999,0.425779291565076,0.309016994374951,0.187381314585729,0.0627905195293178,−0.0627905195293086,−0.187381314585719,−0.309016994374942,−0.425779291565067,−0.535826794978991,−0.637423989748685,−0.728968627421407,−0.809016994374943,−0.876306680043860,−0.929776485888248,−0.968583161128629,−0.992114701314477,−1.00000000000000,−0.992114701314479,−0.968583161128633,−0.929776485888255,−0.876306680043868,−0.809016994374954,−0.728968627421419,−0.637423989748699,−0.535826794979006,−0.425779291565084,−0.309016994374959,−0.187381314585738,−0.0627905195293262,0.0627905195292995,0.187381314585711,0.309016994374934,0.425779291565060,0.535826794978984,0.637423989748678,0.728968627421401,0.809016994374938,0.876306680043856,0.929776485888245,0.968583161128627,0.992114701314475,1.,0.992114701314480,0.968583161128636,0.929776485888258,0.876306680043873,0.809016994374959,0.728968627421425,0.637423989748705,0.535826794979014,0.425779291565092,0.309016994374968,0.187381314585746,0.0627905195293359,−0.0627905195292909,−0.187381314585702,−0.309016994374925,−0.425779291565051,−0.535826794978976,−0.637423989748671,−0.728968627421394,−0.809016994374932,−0.876306680043851,−0.929776485888242,−0.968583161128624,−0.992114701314474,−1.00000000000000,−0.992114701314481,−0.968583161128638,−0.929776485888262,−0.876306680043877,−0.809016994374965,−0.728968627421431,−0.637423989748713,−0.535826794979022,−0.425779291565100,−0.309016994374976,−0.187381314585755,−0.0627905195293443,0.0627905195292813,0.187381314585693,0.309016994374916,0.425779291565043,0.535826794978968,0.637423989748664,0.728968627421388,0.809016994374927,0.876306680043846,0.929776485888238,0.968583161128622,0.992114701314473,…,⋯ 100 Array entries not shown
A plot of the signal vs the index position (note that this is not equal to time):
SignalPlot⁡signal
To plot the signal vs time, the sampling rate and signal frequency are required:
SamplingRate≔1000:
SignalPlot⁡signal,samplerate=SamplingRate⁢RelativeFrequency
The SignalProcessing[GenerateTone] command was introduced in Maple 17.
For more information on Maple 17 changes, see Updates in Maple 17.
See Also
GenerateSlope
GenerateTriangle
SignalPlot
Download Help Document