Sign in

username:

password:



Not a member?

Search Online Books



Search tips

Free Online Books



Chapters

Chapter Contents:

Search Introduction to Digital Filters

  

Book Index | Global Index


Would you like to be notified by email when Julius Orion Smith III publishes a new entry into his blog?

  

Time Plots: myplot.m

Figure J.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 J.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);


Order a Hardcopy of Introduction to Digital Filters

Previous: Matlab Utilities
Next: Frequency Plots: freqplot.m

written by Julius Orion Smith III
Julius Smith's background is in electrical engineering (BS Rice 1975, PhD Stanford 1983). He is presently Professor of Music and Associate Professor (by courtesy) of Electrical Engineering at Stanford's Center for Computer Research in Music and Acoustics (CCRMA), teaching courses and pursuing research related to signal processing applied to music and audio systems. See http://ccrma.stanford.edu/~jos/ for details.


Comments


No comments yet for this page


Add a Comment
You need to login before you can post a comment (best way to prevent spam). ( Not a member? )