SignalPlot - Maple Help

# Online Help

###### All Products    Maple    MapleSim

SignalProcessing

 SignalPlot
 plot a signal

 Calling Sequence SignalPlot(f)

Parameters

 f - string, rtable, or list ; signals to be plotted

Options

 • channel, column : posint, or list(posint) : channel or rtable column, or list of these
 • compactplot : truefalse : indicates if multiple plots should be displayed in a compact form
 • detrend : truefalse : indicates if the data should have any trend removed
 • reduceplot : truefalse or posint : indicates that plot resolution is to be reduced
 • samplerate : realcons : the sample rate
 • timeunit : anything

Description

 • The SignalPlot command plots one or more signals. The input f can be the name of a file containing an audio signal, an rtable, or a list. See AudioTools:-Format for information about the kinds of files accepted.
 • If f is an $m$ by $n$ Matrix (or 2-dimensional Array), then it is assumed to contain $n$ signals of length $m$. In this case, all signals are plotted and displayed in an array plot. Similarly, if f is an audio signal with multiple channels, then plots for all channels are produced.  If you do not wish to plot all signals, the channel and column options allow you to plot a subset.
 • If f is a list, then every element of the list must be a single-channel audio signal or a 1-dimensional Array.
 • The compactplot option allows multiple plots to be displayed more compactly. When this option is set to true, it is assumed the x-axis labels for all plots are identical and thus they are displayed for the bottommost plot only.
 • The detrend option specifies if the data should have any linear trend removed before being plotted.
 • If the signal is particularly large and the reduceplot option is set to true, then the plot resolution is automatically reduced for efficient rendering. If reduceplot is a positive integer, then the plot is reduced by that factor. The default setting for this option is true.
 • The samplerate option is used to specify a sample rate. Note that audio signals generated by the AudioTools package have the sample rate saved in their attributes.
 • The timeunit option is used to specify the unit time of the sample rate. The default value is s.
 • Additional plotting options as described on the plot/option help page may be included.

Examples

 > $\mathrm{with}\left(\mathrm{SignalProcessing}\right):$
 > $\mathrm{audiofile}≔\mathrm{cat}\left(\mathrm{kernelopts}\left(\mathrm{datadir}\right),"/audio/stereo.wav"\right):$
 > $\mathrm{SignalPlot}\left(\mathrm{audiofile},\mathrm{compactplot}\right)$

Generate a random signal with an added trend.

 > $\mathrm{signal_data}≔\mathrm{GenerateGaussian}\left(100,0.5,0.3\right)+⟨\mathrm{seq}\left(i,i=0.01..1,0.01\right)⟩$
 $\left[\begin{array}{cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc}0.5595371873412779& 0.45389430253864205& 0.8848753851846999& -0.47149036815707185& 0.8389029078187195& 0.47877229884860206& 1.1579020826194304& 0.9648531907159085& 0.6784179640720818& 0.4944664212889266& 0.2684350340055683& 0.2331441814045777& 0.7961879085760813& 1.4923335418697676& 0.41784844003340504& 0.41586887525427263& 0.7994512485834256& 0.9189902991795815& 0.7477827426178085& 0.5595947461678564& 0.8456515648990741& 0.43385597843666607& 0.21410259055455141& 0.681131964717453& 0.6411582723587601& 0.9288535123912929& 0.6474902506617086& 0.5043108274126352& 0.9827530477978295& 0.6765821635087408& 0.9524507828985362& 0.5987918066401041& 0.5135102804094569& 1.1137169060662873& 0.6637887196861881& 0.8287372676763043& 0.9828061389103757& 0.8033191354509455& 0.8125066283808304& 1.020236676992773& 1.0475575699239938& 0.6732770324610202& 1.3251975110948568& 0.620965168568038& 0.6704096894008563& 1.5824916572278682& 0.5225858466123751& 1.186895114183928& 0.9282115932830959& 0.6948168413356008& 0.36968181976413717& 0.608428908432865& 1.2661104532798322& 0.7820333574795313& 1.0248193914065142& 0.9060860832633068& 0.8805757416108783& 0.9137552089298038& 0.8285159060356576& 1.3394702950470418& 1.2508329627354744& 1.1832266243502314& 0.9186525844724822& 0.8378516601196335& 1.1615353135151898& 1.2013914427980636& 1.3765861283576561& 1.335684371153829& 1.0226417274459687& 1.3064270035335612& 1.136547269117135& 1.3351100446290296& 1.3780577047464586& 1.8816505512289048& 0.8672180251437505& 1.0104551922973328& 1.393984290873147& 1.4043262984189027& 1.2342347845980983& 1.434497354682656& 1.4546627193121924& 1.1322719229440406& 1.474937377043506& 1.0771768026141457& 1.457820694449464& 1.0126629278783643& 1.1687681349363668& 1.17175165733169& 2.090125104727279& 1.466201478690468& 1.2358938622209559& 1.8375665498300284& 1.1519829274283875& 1.1963758244926963& 1.2900141935977454& 1.0510595917792755& 1.7189748894859262& 1.865054954656632& 1.552648819618047& 1.2634576295297608\end{array}\right]$ (1)

Plot the signal and the trend line.

 > $\mathrm{with}\left(\mathrm{Statistics}\right):$
 > $\mathrm{plots}:-\mathrm{display}\left(\left[\mathrm{SignalPlot}\left(\mathrm{signal_data},\mathrm{legend}="Data"\right),\mathrm{plot}\left(\mathrm{LinearFit}\left(a+bx,⟨\mathrm{seq}\left(1..100\right)⟩,\mathrm{signal_data},x\right),x=1..100,\mathrm{color}="Black",\mathrm{legend}="Trend",\mathrm{linestyle}=\mathrm{dash}\right)\right]\right)$

Plot the signal, the detrended signal, the trend line and the mean of the detrended data.

 > $\mathrm{plots}:-\mathrm{display}\left(\left[\mathrm{SignalPlot}\left(\mathrm{signal_data},\mathrm{legend}="Original Data"\right),\mathrm{plot}\left(\mathrm{LinearFit}\left(a+bx,⟨\mathrm{seq}\left(1..100\right)⟩,\mathrm{signal_data},x\right),x=1..100,\mathrm{color}="Black",\mathrm{legend}="Trend",\mathrm{linestyle}=\mathrm{dash}\right),\mathrm{SignalPlot}\left(\mathrm{signal_data},\mathrm{detrend},\mathrm{color}="Red",\mathrm{legend}="Detrended Data"\right),\mathrm{plot}\left(\mathrm{Mean}\left(\mathrm{Detrend}\left(\mathrm{signal_data}\right)\right),x=1..100,\mathrm{color}="Red",\mathrm{legend}="Mean of Detrended Data",\mathrm{linestyle}=\mathrm{dot}\right)\right]\right)$
 > 

Compatibility

 • The SignalProcessing[SignalPlot] command was introduced in Maple 18.
 • For more information on Maple 18 changes, see Updates in Maple 18.
 • The SignalProcessing[SignalPlot] command was updated in Maple 2019.
 • The detrend option was introduced in Maple 2019.
 • For more information on Maple 2019 changes, see Updates in Maple 2019.

 See Also