The mexican hat wavelet, obtained from the second derivative of a Gaussian, has a functional form of

$$ \frac{2}{\sqrt{3 \sqrt{\pi} \sigma \ }} \left(1-\frac{t^2}{\sigma^2} \right) e^{-t^2/(2\sigma^2)} $$

where "$\sigma$ is the standard deviation of a Gaussian and $t$ is the independent variable.

If we graphically wish to graphically see its dilations, say at scale $1 \le a \le 5$, the typical form of a wavelet function $\psi$ has a scale parameter $a$ and a translation parameter $b$. The functional form of the Mexican hat given in MATLAB does not explicitly have them both.

The standard deviation $\sigma$ is the only variable here that controls with width, but this is not strictly equal to the scale $a$. How should we generate scaled versions of the Mexican hat?


Mexican hat

  • 1
    $\begingroup$ i think you substitute: $$ t \leftarrow \frac{t-b}{a} $$ to get this in terms of the wavelet params $a$ and $b$. but $a$ and $\sigma$ always team up, so i would set $\sigma=1$ and just normalize the mother wavelet and let $a$ be the sole scaling factor. $\endgroup$ – robert bristow-johnson Jan 15 at 5:22
  • $\begingroup$ I am familiar with the leftward arrow notation. Do you mean to say that we replace in the wavelet equation with (t-b)/a? It seems $a$ and $\sigma$ are inversely related. Larger the $a$ value, wider is the wavelet, in the wavelet literature. If this is the case, then this substitution would be valid. As per wavelet criterion, $\sigma$ has to be 0.68 in the Mexican hat. $\endgroup$ – M. Farooq Jan 15 at 6:50
  • $\begingroup$ yes, i am saying replace $t$ with $\frac{t-b}{a}$. both $\sigma$ and $a$ divide into $t$, so i would think that they team up. if one increases by a factor of 5 and the other decreases by the inverse ratio, the result will be the same wavelet. "$b$" and "$a$" are simply other symbols to express the same translation and scaling that "$\mu$" and "$\sigma$" do. $\endgroup$ – robert bristow-johnson Jan 15 at 7:37
  • $\begingroup$ You can do Latex for equations by yourself. Start by right clicking on an equation and selecting "View math as tex". You can also see RB-J's helpful addition to your post in edit mode. $\endgroup$ – Cedron Dawg Jan 15 at 15:13

Okay, I am not quite understanding your question. Let's start with the definition of the Gaussian, aka the Bell Curve, in its general form.

$$ f(t) = \frac{1}{ \sigma \sqrt{2\pi}} e^{ -\frac{(t-\mu)^2}{2\sigma^2} } $$

$\mu$ is the mean, and represents where the peak occurs.

$\sigma$ is the standard deviation, and identifies where the inflection points are.

Taking the first derivative:

$$ \begin{aligned} f'(t) & = \frac{1}{ \sigma \sqrt{2\pi}}\left[ e^{ -\frac{(t-\mu)^2}{2\sigma^2} } \left( -\frac{(t-\mu)}{\sigma^2} \right) \right] \\ & = - \frac{1}{ \sigma^3 \sqrt{2\pi}}\left[ e^{ -\frac{(t-\mu)^2}{2\sigma^2} } \left( t-\mu \right) \right] \\ \end{aligned} $$

Taking the second derivative.

$$ \begin{aligned} f''(t) &= - \frac{1}{ \sigma^3 \sqrt{2\pi}}\left[ e^{ -\frac{(t-\mu)^2}{2\sigma^2} } \left( -\frac{(t-\mu)}{\sigma^2} \right) \left( t-\mu \right) + e^{ -\frac{(t-\mu)^2}{2\sigma^2} } \left( 1 \right) \right] \\ f''(t) &= \frac{1}{ \sigma^3 \sqrt{2\pi}}\left[ \frac{(t-\mu)^2}{\sigma^2} - 1 \right] e^{ -\frac{(t-\mu)^2}{2\sigma^2} } \\ f''(t) &= \frac{1}{ \sigma^3 \sqrt{2\pi}}\left[ \left( \frac{t-\mu}{\sigma} \right)^2 - 1 \right] e^{ - \frac{1}{2} \left( \frac{t-\mu}{\sigma} \right)^2 } \\ \end{aligned} $$

In your example $\mu=0$ and $\sigma=1$. In your graph, the zero is where the peak is, and the one is the +/-1 on your horizontal scale. Notice that the second derivative is zero at these points (inflection in the original function.)

You can translate the graph by setting $\mu$. You can stretch the graph horizontally by setting $\sigma$.

I am not familiar with wavelets, so I don't know what this $a$ and $b$ are that you are talking about. You can definitely to another coordinate conversion if you want:

$$ t = a \tau + b $$

Gosh, but that is awfully similar to

$$ \frac{1}{\sigma} t - \frac{\mu}{\sigma} $$

that you already got.

Based on the comments, to retrofit the function call to MATLAB (or wherever):

$$ \mu = b $$

$$ \sigma = 0.63628 a $$

| improve this answer | |
  • $\begingroup$ Thanks but understanding the translation part is easy that we shift the Mexican hat to a new time position which was originally $\mu$. Would you mind having a look at this section on Wikipedia en.wikipedia.org/wiki/… $\endgroup$ – M. Farooq Jan 15 at 4:44
  • $\begingroup$ How can one bring the Mexican hat expression into the standard wavelet function form, which is psi_a,b(t)= 1/sqrt(a)psi((t-b)/a)? The value "a" shrinks or dilates the wavelet. It is always called a dilation in wavelet literature. In the Mexican hat expression, only sigma can shrink or dilate the second derivative. I am trying relate sigma with the scale parameter called "a". A larger value of "a" means a wider wavelet. So it seems a and sigma are inversely related. $\endgroup$ – M. Farooq Jan 15 at 4:47
  • $\begingroup$ i think it's, with $\mu=0$ and $\sigma=1$ then usually the only variable of a mother wavelet would be $$ t = \frac{\tau - b}{a}$$. or maybe $t$ and $\tau$ are swapped. $\endgroup$ – robert bristow-johnson Jan 15 at 5:10
  • 1
    $\begingroup$ i dunno, Ced, the wikipedia definition for Mexican hat is $$ \psi(t) = \frac{2}{\sqrt{3\sigma}\pi^{1/4}} \left(1 - \left(\frac{t}{\sigma}\right)^2 \right) e^{-\frac{t^2}{2\sigma^2}} $$ which is consistent with the OP. $\endgroup$ – robert bristow-johnson Jan 15 at 5:19
  • 1
    $\begingroup$ @M.Farooq When you plug $$ \frac{t-b}{a} $$ in for $t$ within $ \frac{t}{\sigma} $ you simply get: $$ \frac{t-b}{a\sigma} $$ So adjusting $a$ and $\sigma$ have reciprical effect from each other. $\endgroup$ – Cedron Dawg Jan 15 at 15:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.