Step 1: Let the endpoints of diameter be \(A(x_1,y_1)\) and \(B(x_2,y_2)\).
The \(x\)-coordinates satisfy
\[
x^2+2x-a^2=0
\]
So,
\[
x_1+x_2=-2
\]
and
\[
x_1x_2=-a^2
\]
The \(y\)-coordinates satisfy
\[
y^2+4y-b^2=0
\]
So,
\[
y_1+y_2=-4
\]
and
\[
y_1y_2=-b^2
\]
Step 2: Use equation of circle with diameter endpoints.
The circle with \(AB\) as diameter is
\[
(x-x_1)(x-x_2)+(y-y_1)(y-y_2)=0
\]
Step 3: Expand the equation.
\[
x^2-(x_1+x_2)x+x_1x_2+y^2-(y_1+y_2)y+y_1y_2=0
\]
Step 4: Substitute values.
\[
x^2-(-2)x-a^2+y^2-(-4)y-b^2=0
\]
\[
x^2+y^2+2x+4y-a^2-b^2=0
\]
Step 5: Final conclusion.
Therefore,
\[
\boxed{x^2+y^2+2x+4y-a^2-b^2=0}
\]