Skip to content

Commit 2bd0f48

Browse files
committed
add demo
1 parent 13dd1ee commit 2bd0f48

2 files changed

Lines changed: 65 additions & 0 deletions

File tree

Changes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
- list_windows now returns a list, not print to selected filehandle
44
- use PDL::Graphics::Simple for plotting
55
- add plotting-object arg to plot{,_freq}
6+
- add demo
67

78
0.101 2024-09-11 20:13:59 BST
89

lib/PDL/Demos/DSPWindows.pm

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
package PDL::Demos::DSPWindows;
2+
3+
use PDL::Graphics::Simple;
4+
use PDL::DSP::Windows;
5+
6+
sub info {('dsp_windows', 'DSP windowing (Req.: PDL::Graphics::Simple)')}
7+
8+
sub init {'
9+
use PDL::Graphics::Simple;
10+
'}
11+
12+
my @demo = (
13+
[act => q|
14+
# This demo illustrates the PDL::DSP::Windows module,
15+
# which provides many window functions for digital signal processing
16+
17+
use PDL::DSP::Windows;
18+
$w = pgswin(multi=>[1,2]); # PDL::Graphics::Simple window
19+
|],
20+
21+
[act => q|
22+
# The Hamming window
23+
$dspw = PDL::DSP::Windows->new(50, 'hamming');
24+
$dspw->plot($w); $dspw->plot_freq($w);
25+
|],
26+
27+
[act => q|
28+
# The "exact" Hamming window
29+
$dspw = PDL::DSP::Windows->new(50, 'hamming_ex');
30+
$dspw->plot($w); $dspw->plot_freq($w);
31+
|],
32+
33+
[act => q|
34+
# The Hann window
35+
$dspw = PDL::DSP::Windows->new(50, 'hann');
36+
$dspw->plot($w); $dspw->plot_freq($w);
37+
|],
38+
39+
[act => q|
40+
# The Welch window
41+
$dspw = PDL::DSP::Windows->new(50, 'welch');
42+
$dspw->plot($w); $dspw->plot_freq($w);
43+
|],
44+
45+
[act => q|
46+
# The Bartlett window
47+
$dspw = PDL::DSP::Windows->new(50, 'bartlett');
48+
$dspw->plot($w); $dspw->plot_freq($w);
49+
|],
50+
51+
[comment => q|
52+
This concludes the demo.
53+
54+
Be sure to check the documentation for PDL::DSP::Windows, to see further
55+
possibilities.
56+
|],
57+
);
58+
59+
sub demo { @demo }
60+
sub done {'
61+
undef $w;
62+
'}
63+
64+
1;

0 commit comments

Comments
 (0)