help-octave
[Top][All Lists]
Advanced

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

Re: I have modified firls.m to include all types of FIRs plus HT and dif


From: Nicholas Jankowski
Subject: Re: I have modified firls.m to include all types of FIRs plus HT and diff
Date: Mon, 22 May 2017 16:37:57 -0400

On Mon, May 22, 2017 at 4:03 PM, Nicholas Jankowski <address@hidden> wrote:


On Mon, May 22, 2017 at 3:48 PM, Nicholas Jankowski <address@hidden> wrote:
On Mon, May 22, 2017 at 11:44 AM, je suis <address@hidden> wrote:

Now I am getting some results but, rather than keeping on uploading
versions, maybe it would be less time consuming if someone would
simply verify the inputs below.



Additionally, I quickly verified that Matlab will accept either a row or column vector for F, A, or w without any change in output (which is always a row vector)



I noticed you still don't have any self-tests at the end of the function.  Recommend adding some as you go along. I put a few at the end of this email that should work for some input validation, row/column checking, and checks one simple output. (the 4th line).  You can just cut/paste them into your function after the final endfunction line.

Putting these together helps capture function intent, so you'll know if later changes by you or someone else breaks something unintentionally. For example, making these showed your input check on N could be a bit more robust, as checking length=1 doesn't check if it's actually a valid input.  E.g., in Matlab trying the following gives:

>> firls (2.2, [0 1], [0 1])
Error using firls (line 110)
Filter order must be a real, positive integer.

TESTS:



%!assert (isrow(firls (2, [0 1], [0 1])), true)
%!assert (isrow(firls (2, [0 1]', [0 1])), true)
%!assert (isrow(firls (2, [0 1], [0 1]')), true)
%!assert (firls (2, [0 1], [0 1]), [-0.202642367284676 0.5 ...
%!        -0.202642367284676], 1e-12)

## Test input validation
%!error <narginchk: not enough input arguments> firl ()
%!error <narginchk: not enough input arguments> firls (1)
%!error <narginchk: not enough input arguments> firls (1, 2)
%!error <narginchk: too many input arguments> firls (1, 2, 3, 4, 5, 6)
%!error firls (2.2, [0 1], [0 1])


reply via email to

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