Jump to content

Wikipedia:Reference desk/Archives/Miscellaneous/2023 January 14

From Wikipedia, the free encyclopedia
Miscellaneous desk
< January 13 << Dec | January | Feb >> January 15 >
Welcome to the Wikipedia Miscellaneous Reference Desk Archives
The page you are currently viewing is a transcluded archive page. While you can leave answers for any questions shown below, please ask new questions on one of the current reference desk pages.


January 14

[edit]

Origin of current levels of O3 in the Pacific

[edit]

Using the current SILAM model in Ventusky, I’m trying to figure out where the unusual levels of O3 we are seeing in the Hawaiian Islands is coming from right now. Looking at the circulation models doesn’t give me a good understanding. It’s very strange to me. Any ideas where it is coming from? Viriditas (talk) 02:22, 14 January 2023 (UTC)[reply]

Cascading damped Goertzel filters to achieve a steeper response

[edit]

I know how to add damping parameter to Goertzel filters to enable it to be used as sliding DFT with exponential windowing like this:

function calcGoertzel(waveform, coeff, decay = 0.99) {
  let f1 = 0, f2 = 0, sine; // no need to initialize this after every calculation is done, so reuse these coefficients on subsequent calculations
  for (const x of waveform) {
    sine = x + coeff * f1 - f2;
    f2 = f1 * decay;
    f1 = sine * decay;
  }
  return Math.sqrt(f1 ** 2 + f2 ** 2 - coeff * f1 * f2) / waveform.length;
}

Theoretically, like IIR filters, it can be cascaded to get a steeper frequency response (like 4th order similar to Gammatone filters). However, I'm having a trouble implementing the cascaded Goertzel filter like this:

function calcGoertzel(waveform, coeff, decay = 0.99) {
  let f1 = 0, f2 = 0, f3 = 0, f4 = 0, f5 = 0, f6 = 0, f7 = 0, f8 = 0, sine, sine2, sine3, sine4; // no need to initialize this after every calculation is done, so reuse these coefficients on subsequent calculations
  for (const x of waveform) {
    sine = x + coeff * f1 - f2;
    f2 = f1 * decay;
    f1 = sine * decay;
    sine2 = f2 + coeff * f3 - f4;
    f4 = f3 * decay;
    f3 = sine2 * decay;
    sine3 = f4 + coeff * f5 - f6;
    f6 = f5 * decay;
    f5 = sine3 * decay;
    sine4 = f6 + coeff * f7 - f8;
    f8 = f7 * decay;
    f7 = sine4 * decay;
  }
  return Math.sqrt(f7 ** 2 + f8 ** 2 - coeff * f7 * f8) / waveform.length;
}

Cascading these filters work, but not in a proper way (huge amplitude boosts and increased amplitude on bass frequencies with frequency slope similar to a low-pass filter). Is there any way to avoid these problems while cascading Goertzel filters for faster SWIFT (sliding windowed infinite Fourier transform) calculation? 2001:448A:304B:1D83:C9D7:338D:5AB9:C88A (talk) 10:53, 14 January 2023 (UTC)[reply]

I have no idea, but I think you want the science desk. --Viennese Waltz 11:54, 14 January 2023 (UTC)[reply]
@Viennese Waltz Here's the showcase of my attempt to cascade Goertzel filters in series. As you can see, the amplitude for the resulting envelope (Gammatone window function) is higher the closer they are to DC offset or Nyquist frequency. 2001:448A:304B:1D83:700A:1AA7:E06:B2B1 (talk) 12:30, 15 January 2023 (UTC)[reply]
I don't know anything about that. I'm just saying that you've posted your query on the wrong reference desk. You want the science desk. --Viennese Waltz 14:33, 15 January 2023 (UTC)[reply]
Or math, or computing. —Tamfang (talk) 04:13, 18 January 2023 (UTC)[reply]
@Tamfang: Now, I just posted the questions related to this at the right venue. Apologies for posting on the wrong venue and hopefully somebody will give the satisfying answer for this difficult-to-digest question. 2001:448A:304B:18C2:85DA:D596:AFD3:58FB (talk) 14:52, 20 January 2023 (UTC)[reply]

How sure are you that Goertzel filters "like IIR filters, ... can be cascaded to get a steeper frequency response"? If by "steeper frequency response" you want finer frequency resolution, that requires running the underlying DFT for a longer sampling time (more samples). Philvoids (talk) 14:25, 16 January 2023 (UTC)[reply]

@Philvoids: What I meant by steeper frequency response is the rate in which spectral leakage are attenuated as described in [1] and as for the impulse response or the resulting window function, this [2]. Therefore, higher order filters is closer to normal distribution than Cauchy distribution in terms of frequency response. 2001:448A:304B:1D83:A1BE:C2C2:6856:DF9C (talk) 15:27, 17 January 2023 (UTC)[reply]

Wikipedia has articles about Fourier_analysis and some variants such as continuous-time or discrete-time STFTs (Short-time_Fourier_transforms). Concerning continuous real-time digital signal analysis, our article about Sliding_DFT needs more work but does state: "implementing the window function on a sliding DFT is difficult due to its recursive nature, therefore it is done exclusively in a frequency domain. There is an alternate way to implement the sliding DFT, called sliding Goertzel algorithm, which does the same except it can calculate magnitudes directly." However where only a few frequency components are to be calculated, the Goertzel_algorithm by using real-only coefficients offers computing efficiency relative to a DFT, but it is vulnerable to numerical-error accumulation when computed using low-precision arithmetic and long input sequences.

A sliding DFT (SDFT) can compute individual DFT bins recursively but is only marginally stable and requires storing N previous inputs. Furthermore, its rectangular window causes spectral leakage. We need expert help to create an article about how these limitations can be overcome in a SWIFT (Sliding Windowed Infinite Fourier Transform) for which we find these references:

[3], [4], [5] (introduces a modified version of the SWIFT algorithm, called the αSWIFT, which further reduces spectral leakage), [6], [7] and [8]. Philvoids (talk) 22:52, 20 January 2023 (UTC)[reply]