octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #51310] firls.m modification to include all 4


From: Vlad
Subject: [Octave-bug-tracker] [bug #51310] firls.m modification to include all 4 FIR types, Hilbert transformer, and differentiator
Date: Sun, 25 Jun 2017 15:00:15 -0400 (EDT)
User-agent: Mozilla/5.0 (Windows NT 6.1; rv:52.0) Gecko/20100101 Firefox/52.0

URL:
  <http://savannah.gnu.org/bugs/?51310>

                 Summary: firls.m modification to include all 4 FIR types,
Hilbert transformer, and differentiator
                 Project: GNU Octave
            Submitted by: archbugaboo
            Submitted on: Sun 25 Jun 2017 07:00:13 PM UTC
                Category: Octave Forge Package
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Feature Request
                  Status: None
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: 4.2.1
        Operating System: Any

    _______________________________________________________

Details:

Following the discussions in the Octave mailing lists, namely
https://lists.gnu.org/archive/html/help-octave/2017-05/msg00136.html and
https://lists.gnu.org/archive/html/help-octave/2017-06/msg00058.html, I
managed to get this version for firls.m that allows creating all four types of
FIR, plus Hilbert transformers and differentiators, the latter allowing either
weighted bands or a special 1/f^2 weighting, all according to Matlab's
description. The script has some differences between Matlab's, as follows:

1. It uses the more recent advances in Octave's builtin expint() (see
http://hg.savannah.gnu.org/hgweb/octave/file/tip/scripts/specfun/expint.m),
which corrects the previous function for completely imaginary arguments.

2. The derivation for the least-squares FIR is different than those mentioned
in Matlab's online help
(https://nl.mathworks.com/help/signal/ref/firls.html#bqih5y1-1 and
https://nl.mathworks.com/help/signal/ref/firls.html#bqih5y9-1), and also the
one in the original firls.m script (Ivan Selesnick's paper), and it involves
sine and cosine integrals, and cos(x)/x terms. Ci(0) and cos(0)/0 result in
Inf, and Matlab must use some sort of avoiding (most probably a small number
for the frequency at zero) in orcer to circumvent the Inf problem. In my
derivation, I considered their values as zero, in the same way type III FIRs
require the impulse response be zero at h[M]. As a consequence, after
verifying the resposnes side by side, and the derivatives of their FFTs, I
conclude that my numbers are closer to reality, thus the results between
Octave and Matlab are different, but not necessarily wrong.

3. This is more of a personal view. Types II and IV FIRs have a builtin zero
at Nyquist, while types III an additional zero at DC, so having a type II
highpass FIR will come with inherent downsides. But this doesn't mean that one
cannot build a type II highpass FIR, since the books clearly warn you that
making one will not yield what you would expect, but you can create one if you
so wish. Because of this, my script does not increment the order behind your
back in order to give what the script might think I want to see, instead, it
lets you create your type II highpass FIR and enjoy the crippled magnitude, if
that is what you wish. In short, it does not think it knows your thoughts
better, but considers you know what you're doing (since you're using the
scrpt), and you're a grown up that knows how to handle the responsabilities.
If not, whatever would you be doing here in the first place?

The original script did its job, but only allowed the creation of type I
FIRs.

As for the uploading of the script, I'm in doubt. I uploaded the script, but
it can also be found at https://github.com./archbugaboo/Octave_signal.



    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Sun 25 Jun 2017 07:00:13 PM UTC  Name: firls.m  Size: 34kB   By:
archbugaboo

<http://savannah.gnu.org/bugs/download.php?file_id=41044>

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?51310>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]