In the equation of a Gaussian below, I can specify the height (a), width (c) and center (b).
f(x) = a*e^[-(x-b)^2 / (2c^2)]
The derivative of a Gaussian takes the following form:
What I would like to do is to come up with an equation where I can specify the height, width, and center of a curve like the gaussian derivative.
The derivative of the Gaussian equation above is :
d = (a*(-x).*exp(-((-x).^2)/(2*c^2)))/(c^2);
The 1st order Hermite function takes a similar form.
d = (((pi)^(-1/4)*exp(-0.5*(x.^2))).*x)*sqrt(2);
My goal is to have an equation that takes this general form and allows me to specify a height, width, and center.
You need to do two changes in the expression of the derivative of a Gaussian:
Differentiation preserves changes in height and position. The only problem is that in the expression of the derivative you are missing the parameter b
. You should replace x
by x-b
.
As for changes in width, since the original Gaussian function has area 1
, higher c
produces more width but also less height. To compensate for that, multiply by c
, so that height is unafffected by changes in c
.
So, the parameterized function is
d = c*(a*(-x+b).*exp(-((-x+b).^2)/(2*c^2)))/(c^2);
Example:
figure
hold on
grid
x = -20:.1:20;
a = 1; b = 2; c = 3; % initial values
d = c*(a*(-x+b).*exp(-((-x+b).^2)/(2*c^2)))/(c^2);
plot(x, d, 'linewidth', 1) % blue
a = 2; b = 2; c = 3; % change height
d = c*(a*(-x+b).*exp(-((-x+b).^2)/(2*c^2)))/(c^2);
plot(x, d, 'linewidth', 1) % red
a = 1; b = 7; c = 3; % change center
d = c*(a*(-x+b).*exp(-((-x+b).^2)/(2*c^2)))/(c^2);
plot(x, d, 'linewidth', 1) % yellow
a = 1; b = 2; c = 5; % change width
d = c*(a*(-x+b).*exp(-((-x+b).^2)/(2*c^2)))/(c^2);
plot(x, d, 'linewidth', 1) % purple