Time Plots: myplot.m Next  |  Prev  |  Up  |  Top  |  Index  |  JOS Index  |  JOS Pubs  |  JOS Home  |  Search


Time Plots: myplot.m

Figure H.1: Compatibility matlab function for plotting a real-valued function--Octave version.

 
function myplot(x, y, sym, ttl, xlab, ylab, grd, lgnd)
% MYPLOT - Generic plot - compatibility wrapper for plot()
%          Octave version.  See below for Matlab version.
%          In Octave, title and axis labels must be issued 
%          BEFORE the plot() command.

  if nargin<8, lgnd=''; end
  if nargin<7, grd=1; end
  if nargin<6, ylab=''; end
  if nargin<5, xlab=''; end
  if nargin<4, ttl=''; end
  if nargin<3, sym='*k'; end
  if nargin<2, y=x; x=0:length(y)-1; end

  title(ttl); 
  ylabel(ylab);
  xlabel(xlab); 
  if grd, grid('on'); else grid('off'); end
  plot(x,y,sym); 
  legend(lgnd);

Figure H.2: Compatibility matlab function for plotting a real-valued function--Matlab version.

 
function myplot(x, y, sym, ttl, xlab, ylab, grd, lgnd)
% MYPLOT - Generic plot - compatibility wrapper for plot()
%          Matlab version. Title and axis labels must be
%          placed AFTER the plot() command.

  if nargin<8, lgnd=''; end
  if nargin<7, grd=1; end
  if nargin<6, ylab=''; end
  if nargin<5, xlab=''; end
  if nargin<4, ttl=''; end
  if nargin<3, sym='*k'; end
  if nargin<2, y=x; x=0:length(y)-1; end

  plot(x,y,sym); 
  title(ttl);
  ylabel(ylab);
  xlabel(xlab);
  if grd, grid('on'); end
  legend(lgnd);


Next  |  Prev  |  Up  |  Top  |  Index  |  JOS Index  |  JOS Pubs  |  JOS Home  |  Search

[How to cite this work] [Order a printed hardcopy]

``Introduction to Digital Filters with Audio Applications'', by Julius O. Smith III, (August 2006 Edition).
Copyright © 2007-02-02 by Julius O. Smith III
Center for Computer Research in Music and Acoustics (CCRMA),   Stanford University
CCRMA  [Automatic-links disclaimer]