mirror of
https://github.com/gonum/gonum.git
synced 2025-10-07 16:11:03 +08:00
dsp/window: add lookup table window functions
This commit is contained in:
@@ -103,3 +103,18 @@ func ExampleHamming() {
|
||||
// srcCpy: [0.092577 0.136714 0.220669 0.336222 0.472063 0.614894 0.750735 0.866288 0.950242 0.994379 0.994379 0.950242 0.866288 0.750735 0.614894 0.472063 0.336222 0.220669 0.136714 0.092577]
|
||||
// dst: [0.092577 0.136714 0.220669 0.336222 0.472063 0.614894 0.750735 0.866288 0.950242 0.994379 0.994379 0.950242 0.866288 0.750735 0.614894 0.472063 0.336222 0.220669 0.136714 0.092577]
|
||||
}
|
||||
|
||||
func ExampleValues() {
|
||||
src := []float64{1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1}
|
||||
|
||||
// Create a Sine Window lookup table.
|
||||
sine := window.NewValues(window.Sine, len(src))
|
||||
|
||||
// Apply the transformation to the src.
|
||||
fmt.Printf("dst: %f\n", sine.Transform(src))
|
||||
|
||||
// Output:
|
||||
//
|
||||
// dst: [0.078459 0.233445 0.382683 0.522499 0.649448 0.760406 0.852640 0.923880 0.972370 0.996917 0.996917 0.972370 0.923880 0.852640 0.760406 0.649448 0.522499 0.382683 0.233445 0.078459]
|
||||
}
|
||||
|
Reference in New Issue
Block a user