SignalProcessing - Maple Programming Help

Home : Support : Online Help : Science and Engineering : Signal Processing : Signal Generation : SignalProcessing/GenerateTone

SignalProcessing

 GenerateTone
 generate a tone

 Calling Sequence GenerateTone( n, magnitude, frequency, phase )

Parameters

 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)

Options

 • container : Array, predefined Array for holding results

Description

 • 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.
 • 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.

 • The SignalProcessing[GenerateTone] command is thread-safe as of Maple 17.

Examples

 > $\mathrm{with}\left(\mathrm{SignalProcessing}\right):$
 > $\mathrm{GenerateTone}\left(10,1,\frac{1}{\mathrm{Pi}},\mathrm{Pi}\right)$
 $\left[\begin{array}{cccccccccc}{-1.}& {0.416146836441423}& {0.653643621350037}& {-0.960170286323670}& {0.145500032130977}& {0.839071530285352}& {-0.843853957257653}& {-0.136737221452173}& {0.957659481417869}& {-0.660316704993774}\end{array}\right]$ (1)

The container option can be used to put generated values into a predefined Array.

 > $c≔\mathrm{Array}\left(1..10,\mathrm{datatype}={\mathrm{float}}_{8},\mathrm{order}=\mathrm{C_order}\right):$
 > $\mathrm{GenerateTone}\left(10,1,\frac{1}{\mathrm{Pi}},\mathrm{Pi},\mathrm{container}=c\right)$
 $\left[\begin{array}{cccccccccc}{-1.}& {0.416146836441423}& {0.653643621350037}& {-0.960170286323670}& {0.145500032130977}& {0.839071530285352}& {-0.843853957257653}& {-0.136737221452173}& {0.957659481417869}& {-0.660316704993774}\end{array}\right]$ (2)
 > $c$
 $\left[\begin{array}{cccccccccc}{-1.}& {0.416146836441423}& {0.653643621350037}& {-0.960170286323670}& {0.145500032130977}& {0.839071530285352}& {-0.843853957257653}& {-0.136737221452173}& {0.957659481417869}& {-0.660316704993774}\end{array}\right]$ (3)
 > $\mathrm{SignalPlot}\left(\mathrm{GenerateTone}\left(100,1,\frac{1}{\mathrm{Pi}},\mathrm{Pi}\right)\right)$ > $\mathrm{nSamples}≔200:$
 > $\mathrm{RelativeFrequency}≔0.02:$
 > $\mathrm{signal}≔\mathrm{Array}\left(\mathrm{GenerateTone}\left(\mathrm{nSamples},1,\mathrm{RelativeFrequency},0\right)\right)$
  (4)

A plot of the signal vs the index position (note that this is not equal to time):

 > $\mathrm{SignalPlot}\left(\mathrm{signal}\right)$ To plot the signal vs time, the sampling rate and signal frequency are required:

 > $\mathrm{SamplingRate}≔1000:$
 > $\mathrm{SignalPlot}\left(\mathrm{signal},\mathrm{samplerate}=\mathrm{SamplingRate}\mathrm{RelativeFrequency}\right)$ Compatibility

 • The SignalProcessing[GenerateTone] command was introduced in Maple 17.