SignalProcessing Improvements in Maple 2024
The SignalProcessing package has been expanded with new and updated commands.
with( SignalProcessing ):
ResponseSpectrum
IntegrateData and IntegrateData2D
FindPeakPoints
The new SignalProcessing:-ResponseSpectrum command is used to plot the response of a structure or system to varying frequencies of ground motion or input excitation. A response spectrum is commonly used in structural and earthquake engineering to assess the potential response of a structure to seismic events.
Consider the following vibration data from the El Centro earthquake of 1940:
file := FileTools:-JoinPath( [ kernelopts( 'datadir' ), "datasets", "el-centro_NS.txt" ] ):
data := ImportMatrix( file, 'delimiter' = " " );
dataplot( data[..,1], data[..,2], 'style' = 'line', 'color' = 'burgundy', 'title' = "El Centro Earthquake Vibration Data", 'size' = [800,400] );
For appropriate choices of parameters, we can obtain a collection of charts and data containers:
R := ResponseSpectrum( data, 0.02, 0.01, 5, 'zeta' = 0.02, 'beta' = 0.25, 'gamma' = 0.5, 'output' = 'record' ):
For example, we can view the plot of acceleration:
R['absoluteaccelerationplot'];
The SignalProcessing:-IntegrateData command has been updated to include an option initial to specify the initial area and output option running to return running totals. For example, suppose we want to determine position from velocity:
t1 := 0.0:
t2 := 2.0:
n := 100:
( dt, T, V ) := GenerateSignal( t * exp(-t/2) * sin(2*t*Pi), t = t1 .. t2, n, 'output' = ['timestep','times','signal'] );
x0 := 1.0:
X := IntegrateData( V, 'step' = dt, 'initial' = x0, 'method' = 'trapezoid', 'output' = 'running' );
dataplot( T, [ V, X ], 'color' = ['darkgreen','blue'], 'labels' = ["time",""], 'legend' = ['velocity','position'], 'style' = 'line', 'size' = [800,400] );
The SignalProcessing:-IntegrateData and SignalProcessing:-IntegrateData2D commands have also been updated to be units aware. For example:
T := Vector( [1,2,3], 'datatype' = 'float[8]' ) * Unit('s');
T≔1.⁢s2.⁢s3.⁢s
V := Vector( [1,4,9], 'datatype' = 'float[8]' ) * Unit('m/s');
V≔1.⁢ms4.⁢ms9.⁢ms
IntegrateData( V, 'step' = 1.0 * Unit('s') );
9.⁢m
IntegrateData( T, V );
X := IntegrateData( T, V, 'output' = 'running' );
X≔0.2.50000000000000⁢m9.⁢m
The heavy computations involved in the SignalProcessing:-FindPeakPoints command have been moved to external code, resulting in a substantial increase in speed. For example:
n := 25000:
A := Vector( n, i -> 1 - i * (-1)^(i+1), 'datatype' = 'float[8]' ):
R := CodeTools:-Usage( FindPeakPoints( A, 'output' = 'record' ), 'iterations' = 10 ):
memory used=5.60MiB, alloc change=87.32MiB, cpu time=35.10ms, real time=30.60ms, gc time=9.24ms
The CPU time required in Maple 2024 is about 100 times smaller than in Maple 2023.
Two new output options, extremes and extremeindices, have also been added to the command:
f := sin(t) + 1/2 * cos(3*t):
a := 0:
b := 2 * Pi:
( T, X ) := GenerateSignal( f, t = a .. b, n, 'output' = ['times','signal'] );
E := FindPeakPoints( T, X, 'output ' = 'extremes' );
E≔0.0.5000000000000000.2538660730173570.6130150062336140.8885312555607500.3317287399642952.030928584138861.386958122922693.36372546747998−0.6133370801579344.06185716827771−0.3315778740227965.14078797860148−1.389378482161776.283185307179590.500000000000000
p := dataplot( T, X, 'style' = 'line', 'legend' = "Signal", 'color' = 'firebrick' ):
q := dataplot( E[..,1], E[..,2], 'style' = 'line', 'legend' = "Extremes", 'color' = 'blue' ):
plots:-display( p, q, 'size' = [800,400] );
Download Help Document