File:Continuous wavelet transform.gif
Summary
Description |
English: A (continuous) wavelet transform is given by the integral of the product between signal s and the kernel (wavelet) w, where the kernel is both shifted and stretched, allowing to extract information at different scales. |
Date | |
Source | https://twitter.com/j_bertolotti/status/1224296204173021184 |
Author | Jacopo Bertolotti |
Permission (Reusing this file) |
https://twitter.com/j_bertolotti/status/1030470604418428929 |
Mathematica 11.0 code
wavelet[x_] := E^(-(x^2/2)) Cos[\[Pi] x]; (*Define your wavelet*)
signal = 1.3 E^(-((x + 3)^2/(2 0.2))) Cos[1.6 \[Pi] x] + 0.5 E^(-((x - 1)^2/(2 2))) Cos[0.5 \[Pi] x] - 0.5 E^(-((x + 0)^2/(2 4))) Cos[2 \[Pi] x]; (*Define your signal*)
tmp = Table[{\[CapitalDelta], \[Sigma], NIntegrate[signal*wavelet[(x - \[CapitalDelta])/\[Sigma]], {x, -20, 20}]}, {\[CapitalDelta], -6, 6, 0.05}, {\[Sigma], 0.1, 2.4, 0.2}]; (*Calculate the wavelet transform for a discrete set of shifts and stretchings*)
p1 = Table[
Grid[{{
Plot[{signal, wavelet[(x - tmp[[All, m]][[All, 1]][[l]])/tmp[[All, m]][[All, 2]][[1]]], signal*wavelet[(x - tmp[[All, m]][[All, 1]][[l]])/tmp[[All, m]][[All, 2]][[1]]]}, {x, -7, 7}, PlotRange -> All,
PlotStyle -> {Directive[Black], Directive[Red], Directive[Thin, Purple]}, Filling -> {3 -> Axis}, ImageSize -> Large, Ticks -> None, Axes -> {True, False}]
,
Show[
Table[
ListPointPlot3D[If[n < m, tmp[[All, n]], tmp[[1 ;; l, n]]] , PlotRange -> {{-6, 6}, {0, 2.35}, {-0.7, 0.7}}, PlotStyle -> Directive[Black], Filling -> Bottom, FillingStyle -> Directive[White, Thickness[0.005] ], ViewPoint -> {1.3, 2.4, 2.}] /. Point[a___] :> {Thickness[0.015], Line[a]}
, {n, 1, m}]
, PlotLabel -> "\[Integral]s(x)*w(\!\(\*FractionBox[\(x - \[CapitalDelta]\), \(\[Sigma]\)]\)) dx", LabelStyle -> {Black, Bold, FontSize -> 18}, AxesLabel -> {"\[CapitalDelta]", "\[Sigma]", ""}, ImageSize -> Large ]
}}]
, {m, 1, Dimensions[tmp][[2]], 1}, {l, 1, Dimensions[tmp][[1]], 10}];
ListAnimate[Flatten[p1]]
Licensing
I, the copyright holder of this work, hereby publish it under the following license:
![]() ![]() |
This file is made available under the Creative Commons CC0 1.0 Universal Public Domain Dedication. |
The person who associated a work with this deed has dedicated the work to the public domain by waiving all of their rights to the work worldwide under copyright law, including all related and neighboring rights, to the extent allowed by law. You can copy, modify, distribute and perform the work, even for commercial purposes, all without asking permission.
|
Category:Animated GIF files
Category:Animated GIF files between 50 MP and 100 MP
Category:Animations of mathematics
Category:CC-Zero
Category:Images with Mathematica source code
Category:Integral transforms
Category:Pages using deprecated source tags
Category:Self-published work
Category:Signal processing
Category:Wavelets