[Scipy-tickets] [SciPy] #1105: Logarithmic chirp frequency sweep incorrect
SciPy Trac
scipy-tickets@scipy....
Sat Feb 6 19:14:41 CST 2010
#1105: Logarithmic chirp frequency sweep incorrect
-----------------------------------------+----------------------------------
Reporter: johntryan | Owner: somebody
Type: defect | Status: new
Priority: normal | Milestone: 0.8.0
Component: scipy.signal | Version: 0.7.0
Keywords: chirp logarithmic frequency |
-----------------------------------------+----------------------------------
Comment(by warren):
If we accept that 'logarithmic' should implement the formula from the
web site (which seems to be the conclusion from ticket #547), then
the main problem is that the implementation of the
formula is more complicated than necessary. The problem is not that
a log of 0 is taken, but that if f1-f0 = 1, then beta=0 and the formula
currently implemented divides by beta.
The formula for the frequency, f(t), can be written
f(t) = f0 + (f1 - f0)**(t/t1)
(After eliminating beta and doing some algebra, that's what's left.)
Then the phase angle is given by the integral of 2*pi*f(t):
phase = 2*pi * (f0*t + ((f1-f0)**(t/t1) - 1) * t1 / log(f1 - f0))
If the sweep is implemented with this formula, then the only requirement
is that f1 - f0 > 0.
However, I agree that the formula given on that web page is, if not
"incorrect", a strange formula to use. Note that, as pointed out on
the web page, it gives f(0) = f0 + 1! So the frequency sweep goes from
f0+1 to f1, which seems strange and unnecessary.
One "fix" is the formula
f(t) = f0 + (f1 - f0 + 1)**(t/t1) - 1
for which f(0) = f0 and f(t1) = f1. This formula results in
phase = 2*pi * ((f0 - 1)*t + (f1 - f0 + 1)**(t/t1) * t1 / log(f1 - f0 +
1)
but this still does not seem like a natural choice.
The formula you suggest, which I agree makes more sense, can be simplified
to
f(t) = f0*(f1/f0)**(t/t1)
However, your formula for the phase is not correct; to get the phase, you
must integrate 2*pi*f(t), not multiply by 2*pi*t. Integration gives
phase = ((f1/f0)**(t/t1) - 1) * t1 / log(f1/f0)
With this formula, the only constraint is that f0 and f1 are postive and
have the same sign.
I'm working on a revision of chirp() that includes this formula. I'll
send
it to the mailing list soon and get some feedback.
--
Ticket URL: <http://projects.scipy.org/scipy/ticket/1105#comment:1>
SciPy <http://www.scipy.org>
SciPy is open-source software for mathematics, science, and engineering.
More information about the Scipy-tickets
mailing list