Skip to content

Instantly share code, notes, and snippets.

@abbiekressner
Created January 29, 2014 02:00
Show Gist options
  • Save abbiekressner/8680452 to your computer and use it in GitHub Desktop.
Save abbiekressner/8680452 to your computer and use it in GitHub Desktop.
Wrapper to sync Matlab's spectrogram function with Octave's specgram function
function varargout = spectrogram (varargin)
% Matlab: [S,F,T]=spectrogram(x,window,noverlap,nfft,fs)
% Octave: [S [, f [, t]]] = specgram(x [, n [, Fs [, window [, overlap]]]])
if nargin == 5
[varargout{1:nargout}] = specgram (varargin{1},varargin{4},varargin{5},varargin{2},varargin{3});
elseif nargin == 4
[varargout{1:nargout}] = specgram (varargin{1},varargin{4},[],varargin{2},varargin{3});
elseif nargin == 3
[varargout{1:nargout}] = specgram (varargin{1},[],[],varargin{2},varargin{3});
elseif nargin == 2
[varargout{1:nargout}] = specgram (varargin{1},[],[],varargin{2},[]);
elseif nargin == 1
[varargout{1:nargout}] = specgram (varargin{1},[],[],hamming(256),[]);
end
endfunction
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment