bugGNU Octave - Bugs: bug #45232, [octave forge] (signal)...

 
 

bug #45232: [octave forge] (signal) spectrogram function to replace legacy specgram function

Submitter:  Nick Shmyrev <nshmyrev>
Submitted:  Mon 01 Jun 2015 10:39:57 PM UTC
   
 
Category:  Octave Package Severity:  1 - Wish
Priority:  1 - Later Item Group:  Feature Request
Status:  Patch Submitted Assigned to:  None
Originator Name:  Open/Closed:  * Open
Release:  * dev Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Sat 09 Nov 2019 07:32:41 PM UTC, comment #5: 

Well, after playing around with the file, I have some results.

First off I needed to use the pwelch.m file from bug 50820 to get spectrogram.m to work.  Otherwise I get the 'string arg 6 illegal value: psd' error.  Now I can run about half of the examples at the mathworks site.

As to the documentation, I believe that this because I have not installed the file with the package, so please ignore this point.

Chris Gorman <chrisgorman>
Sat 09 Nov 2019 04:28:53 PM UTC, comment #4: 

Hi John (and Mike),

Just trying out the spectrogram function you wrote.  (Thanks for all the hard work.)  I would like to comment on it.

First off running `help spectrogram` gets the following errors for me.


octave:26> help spectrogram
/tmp/octave-help-Wnvppb:125: misplaced }
/tmp/octave-help-Wnvppb:170: table requires an argument: the formatter for @item
/tmp/octave-help-Wnvppb:187: superfluous argument to @end ifinfo: . (possibly involving @seealso)
/tmp/octave-help-Wnvppb:196: table requires an argument: the formatter for @item
/tmp/octave-help-Wnvppb:199: table requires an argument: the formatter for @item
/tmp/octave-help-Wnvppb:199: no matching `@end table'
/tmp/octave-help-Wnvppb:199: bad argument to @end: @table
/tmp/octave-help-Wnvppb:268: `@end' expected `table', but saw `deftypefn'


Are there some installation instructions I need to follow?  All I did was copy the function to the current working directory and tried to run it.  After the errors, the function description follows.

Next, running without setting the command equal to a variable fails to generate a plot for me.   I tried the first example at https://www.mathworks.com/help/signal/ref/spectrogram.html and I get the following.


octave:27> N = 1024;
octave:28> n = 0:N-1;
octave:29>
octave:29> w0 = 2*pi/5;
octave:30> x = sin(w0*n)+10*sin(2*w0*n);
octave:31> s = spectrogram(x);
octave:32>
octave:32> spectrogram(x,'yaxis')
error: pwelch: string arg 6 illegal value: psd
error: called from
    pwelch at line 442 column 11
    spectrogram at line 235 column 19


How do I generate a plot of the data?

I can try out patches, or new versions if you like.  But next week I am busy, so expect some delays in my response times.  Again thanks for all the hard work you've put into octave and thanks in advance for instructions on how to use spectrogram.

Chris Gorman <chrisgorman>
Wed 09 Jan 2019 09:51:09 PM UTC, comment #3: 

I'm attaching my current version.  It includes more info in the docstring.

Mike: could we include this in the signal package now?  Even though the docstring could use some more work, it is probably better than having no spectrogram function at all.

(file #45920)

John W. Eaton <jwe>
Group administrator
Fri 05 Oct 2018 09:39:58 PM UTC, comment #2: 

I started working on this function.  I'm attaching my current version for testing and feedback.  There are still some missing features (compute fc and tc outputs?) and probably some bugs.  But the figures it produces look like the ones for the examples in the Matlab online docs for spectrogram now, at least as far as I can tell (to get exact results, you need to use the same colormap).





(file #45155)

John W. Eaton <jwe>
Group administrator
Tue 02 Jun 2015 03:01:27 AM UTC, comment #1: 

Thanks for your bug report. I'm categorizing this as a feature request to implement the spectogram function with all of the features in Matlab, such as the onesided option.

Mike Miller <mtmiller>
Group Member
Mon 01 Jun 2015 10:39:57 PM UTC, original submission:  

According to Matlab documentation

http://de.mathworks.com/help/signal/ref/spectrogram.html

'onesided' — returns the one-sided spectrogram of a real input signal. If nfft is even, then pxx has length nfft/2 + 1 and is computed over the interval [0, π] rad/sample. If nfft is odd, then pxx has length (nfft + 1)/2 and the interval is [0, π) rad/sample. If you specify fs, then the intervals are respectively [0, fs/2] cycles/unit time and [0, fs/2) cycles/unit time.

specgram must return 257 points for nfft = 512. The current code returns 256 points only.

The suggested change is:

  if rem(n,2)==1
      ret_n = (n+1)/2;
  else
      ret_n = n/2 + 1;
  endif
  S = S(1:ret_n, :);

in specgram.m

Nick Shmyrev <nshmyrev>

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #45920:  spectrogram.m-2019-01-09 added by jwe (18KiB - application/octet-stream)
file #45155:  spectrogram.m-2018-10-05 added by jwe (12KiB - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by chrisgorman (Posted a comment)
  • -email is unavailable- added by jwe (Updated the item)
  • -email is unavailable- added by nshmyrev (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 17 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-02-26 mtmiller StatusPostponed Patch Submitted
        Assigned tomtmiller None
        Releaseother dev
    2019-01-09 jwe Attached File- Added spectrogram.m-2019-01-09, #45920
    2018-10-19 mtmiller Carbon-CopyRemoved 80942 -
    2018-10-05 jwe Attached File- Added spectrogram.m-2018-10-05, #45155
    2018-04-03 mtmiller Priority5 - Normal 1 - Later
        StatusConfirmed Postponed
        Summary[octave forge] (signal) specgram function not equivalent to spectrogram [octave forge] (signal) spectrogram function to replace legacy specgram function
    2017-08-13 jwe Summarysignal package: specgram function not equivalent to spectrogram [octave forge] (signal) specgram function not equivalent to spectrogram
    2015-06-02 mtmiller Severity3 - Normal 1 - Wish
        Item GroupIncorrect Result Feature Request
        StatusNone Confirmed
        Assigned toNone mtmiller
        Releasedev other
        Operating SystemGNU/Linux Any
        Summaryspecgram function does not follow matlab signal package: specgram function not equivalent to spectrogram

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code