patchGNU Octave - Patches: patch #8506, signal package: add the taylorwin...

 
 

patch #8506: signal package: add the taylorwin function

Submitted by:  None
Submitted on:  Wed 06 Aug 2014 12:03:00 AM UTC  
 
Category: NonePriority: 5 - Normal
Status: In ProgressPrivacy: Public
Assigned to: Mike Miller <mtmiller>Originator Email: -unavailable-
Open/Closed: Open

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Wed 27 Aug 2014 09:56:47 PM UTC, comment #4:

Added more test cases and change the error message for the SLL.

The test cases that were added is the ones that will make sure that the function can catch a non scalar N value.

The SLL message was saying SLL must be a negative value, but 0 is fine, so I changed the wording on the error message along with the help message to state so.

Also added error checking to ensure that all the input arguments are scalar values. (Forgot to check this, I was only looking at the size (m) and not n_bar and sll).

(file #31986)

Robert <i1nk>
Wed 27 Aug 2014 02:53:37 AM UTC, comment #3:

I used the file tests.m to compare the answer from taylorwinC.m to Matlab's taylorwin function. taylorwinC is the same as taylorwin but with matlab syntax and less error checking, but the error checking will not affect the answer in anyway. Matlabs version that I tested it with is also in the test.m along with the answers. Other than that I am not sure on how to verify that the function produces the intended values. The only other method I can thing of is to do the math by hand.

I did add the test cases to test that the invalid input would be caught. It is at the end along with a description on what it is catching.

(file #31971, file #31972, file #31973)

Robert <i1nk>
Mon 18 Aug 2014 01:09:16 AM UTC, comment #2:

Ok, I'll start on making those changes.

Robert <i1nk>
Sun 17 Aug 2014 07:47:43 PM UTC, comment #1:

Thanks for your contribution to Octave! This function can definitely be added to the signal package. Would you mind looking at some coding style fixups and adding unit tests?

It would be best for all new functions added to the signal package to adhere to GNU Octave coding style conventions. Here are some suggestions based on a quick review of your submission:

  • Use 2 spaces for indentation
  • Remove trailing spaces from all lines
  • Use endfunction instead of end
  • Omit brackets for single return values
  • Use space before opening parenthesis on function calls, if, switch, etc, no space when indexing
  • For loops: use parentheses on initializers, omit ":1:" for default case of a step-by-one iteration
  • Keep parentheses on function calls with no arguments (e.g. print_usage ())
  • Use "## " for function and in-code comments
  • Make sure to indicate the function name in error messages

Some simple particulars about this function:

  • Just error if the length argument is not a positive integer, refer to other window functions in the signal package for example argument error checking, for example https://hg.mtmxr.com/octave-signal/file/817a7a769729/inst/chebwin.m
  • Use m for the length argument to be consistent with other window functions in the package
  • Prefer lower case variable and inner function names, unless you want to differentiate matrices from scalars using uppercase local variable names

And add test cases if you can, to verify that the function produces the intended values and that it catches errors when given invalid input.

Mike Miller <mtmiller>
Project AdministratorIn charge of this item.
Wed 06 Aug 2014 12:03:00 AM UTC, original submission:

I would like to add the taylorwin function to the signal package. The function was based heavily off the book titled Spotlight Synthetic Aperture Radar Signal Processing Algorithms, By Walter G. Carrara, Ron S. Goodman, and Ronald M. Majewski, and the is ISBN 0-89006-728-7 from Pg 512 - 513.

I broke up each part of the taylor window into smaller functions which call each other when they to be calculated. Also the constants are saved off and passed to the functions if they need that constant to find some other value.

Currently, this function will not work in matlab without changing some of the code style. But it works fine in octave.

I have tested a few cases and compared a few answers to the matlab function.

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

Attached Files
file #31986:  taylorwin.m added by i1nk (7KiB - text/x-objcsrc - Added more error checking and fix the SLL error message.)
file #31971:  taylorwin.m added by i1nk (7KiB - text/x-objcsrc)
file #31972:  tests.m added by i1nk (3KiB - text/x-objcsrc)
file #31973:  taylorwinC.m added by i1nk (2KiB - text/x-objcsrc)
file #31846:  taylorwin.m added by None (7KiB - text/x-objcsrc - This is the function for the patch)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by i1nk (Posted a comment)
  • -unavailable- added by mtmiller (Posted a comment)
  • -unavailable- added by None (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 8 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Tue 22 Dec 2015 06:03:38 PM UTCmtmillerSummaryAdd the taylorwin function to the signal package.=>signal package: add the taylorwin function
    Wed 27 Aug 2014 09:56:47 PM UTCi1nkAttached File-=>Added taylorwin.m, #31986
    Wed 27 Aug 2014 02:53:37 AM UTCi1nkAttached File-=>Added taylorwin.m, #31971
      Attached File-=>Added tests.m, #31972
      Attached File-=>Added taylorwinC.m, #31973
    Sun 17 Aug 2014 07:47:43 PM UTCmtmillerStatusNone=>In Progress
      Assigned toNone=>mtmiller
    Wed 06 Aug 2014 12:03:00 AM UTCNoneAttached File-=>Added taylorwin.m, #31846

    Back to the top


    Powered by Savane 3.1-cleanup1