octave-maintainers
[Top][All Lists]
Advanced

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

Re: request to run spectrogram example code in Matlab


From: Ardid Ramirez, Joan Salvador
Subject: Re: request to run spectrogram example code in Matlab
Date: Thu, 4 Oct 2018 18:59:56 +0000

El dijous, 4 d’octubre de 2018, a les 12:20:18 EDT, John W. Eaton va escriure:

  I'm working on the spectrogram function and can't seem to get the same 
  plots as shown in the Matlab online documentation for this function.
  
  Could someone run the following in a recent version of Matlab and post 
  the resulting sgram.mat file?  This is the first example from the Matlab 
  online documentation for spectrogram.  Also, please verify that the 
  figure you generate looks the same as the one there.
  
  N = 1024;
  n = 0:N-1;
  w0 = 2*pi/5;
  x = sin(w0*n)+10*sin(2*w0*n);
  s = spectrogram (x);
  spectrogram (x, 'yaxis');
  %% For the following, I expect one image object as the
  %% child of the axes object.  If that's not correct, then
  %% can you find the image that is plotted and get the cdata,
  %% xlim, and ylim values?
  h = get (gca, 'children');
  cdata = get (h, 'cdata');
  xlim = get (h, 'xlim');
  ylim = get (h, 'ylim');
  cmap = colormap ();
  save sgram.mat x s cdata xlim ylim cmap
  
  
  Thanks,
  
  jwe
  
Please see attachment (run in Matlab 2018b)

Note that I had to replace:

xlim = get (h, 'xlim');
ylim = get (h, 'ylim');

By:

xlim = get (gco, 'xlim');
ylim = get (gco, 'ylim');

To avoid errors:

Error using matlab.graphics.primitive.Image/get
There is no xlim property on the Image class.

Error using matlab.graphics.primitive.Image/get
There is no ylim property on the Image class.

....
a.

Attachment: sgram.mat
Description: sgram.mat


reply via email to

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