# Gaussian curve, logarithmic width

Started by July 5, 2007
```Hello,

at the moment, I'm trying to implement a parametric equalizer using a
gaussian curve.

It actually works fine so far, but one thing isn't really perfect: The
width of the curve should grow by increasing frequency, which it doesn't
at the moment.

I'm programming with Java and my formula looks like this:

y = Math.pow(Math.E, -q * Math.pow(frq, 2)) * gain * (1 / 2 * PI)
for maybe better reading: y = e^(-q * frq^2) * gain * (1/2 * PI)

The width of the curve is controlled by the factor q. The x value is
represented by frq, which has a range from 0 to 20.0

When I use linear values for q and a linear coordinate system, of course
the curve's width stays the same when the frequency gets higher. But I
want it to become wider the higher the frequency gets.

Then I modified q, so that when you change the q value, it gets replaced
by e^(q/2), which is actually much better than before. But I don't know if
this is the correct approach. When I view it with a logarithmic coordinate
system, it looks more correct, but still it becomes a little thinner when
moving to the right.
On the other hand, I don't even know if my coordinate system has the
correct scale, compared to how I modified the q value.

As you might have already guessed, I'm not the world's best mathematican
;) and especially logarithmic and exponential stuff is a bit hard for me
to understand and visualize.

So my questions would be:
1) How should I calculate the logarithmic coordinate system? I know that
it can be scaled differently, but what would be the best approach?
2) How can I affect the q value for the curve, so that its width always
stays the same, in relation to the coordinate system I use?

Rock Lobster
```
```Rock Lobster schrieb:
> at the moment, I'm trying to implement a parametric equalizer using a
> gaussian curve.

I wonder a bit.
Usually this is better done by IIR filters.
If you place zeros in the negative s-plane then you can compensate for
the group delay too.

> It actually works fine so far, but one thing isn't really perfect: The
> width of the curve should grow by increasing frequency, which it doesn't
> at the moment.

You have to use a ->log-normal distribution rather than a normal
distribution for this purpose..

But I would prefer biquads for a parametric EQ.

And if you are going to generate the amplitude response of an FIR kernel
this way, I would prefer a single sine lobe as shape. Define this shape
in the double logarithmic space, i.e. log(|H|)/log(f) or H in dB vs.
log(f). This gives reasonable results for frequency equalization.

Marcel
```
```>Rock Lobster schrieb:
>> at the moment, I'm trying to implement a parametric equalizer using a
>> gaussian curve.
>
>I wonder a bit.
>Usually this is better done by IIR filters.
>If you place zeros in the negative s-plane then you can compensate for
>the group delay too.
>
>> It actually works fine so far, but one thing isn't really perfect: The
>> width of the curve should grow by increasing frequency, which it
doesn't
>> at the moment.
>
>You have to use a ->log-normal distribution rather than a normal
>distribution for this purpose..
>
>But I would prefer biquads for a parametric EQ.
>
>And if you are going to generate the amplitude response of an FIR kernel

>this way, I would prefer a single sine lobe as shape. Define this shape
>in the double logarithmic space, i.e. log(|H|)/log(f) or H in dB vs.
>log(f). This gives reasonable results for frequency equalization.
>
>
>Marcel
>

Ahh okay, thanks, I looked for log-normal distribution now and it actually
could serve my needs :) (haven't tested it yet)

But what are biquads? I didn't find reasonable stuff with google, at least
nothing that would fit. Is there also a formula for this?
```
```I now checked the log-normal curve, and it has the correct shape, but its
width still doesn't grow depending on the x value (which means, in a
linear coordinate system, the curve still has the same width for e.g. x =
0 and x = 3000).
```
```Rock Lobster schrieb:
> I now checked the log-normal curve, and it has the correct shape, but its
> width still doesn't grow depending on the x value (which means, in a
> linear coordinate system, the curve still has the same width for e.g. x =
> 0 and x = 3000).

You are free to multiply the width by x before you start.

Marcel
```