diff m-toolbox/classes/@specwin/plot.m @ 0:f0afece42f48

Import.
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 23 Nov 2011 19:22:13 +0100
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/m-toolbox/classes/@specwin/plot.m	Wed Nov 23 19:22:13 2011 +0100
@@ -0,0 +1,61 @@
+% PLOT plots a specwin object.
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% DESCRIPTION: PLOT plots a specwin object.
+%
+% CALL:            plot(specwin)
+%              h = plot(specwin)
+%
+% VERSION:     $Id: plot.m,v 1.13 2011/02/17 14:24:55 ingo Exp $
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+function varargout = plot(varargin)
+
+  % Get specwin objects
+  ws = [varargin{:}];
+
+  hl = [];
+
+  hold on
+  grid on;
+
+  colors = getappdata(0,'ltpda_default_plot_colors');
+
+  titleStr  = '';
+  legendStr = '';
+
+  for i=1:numel(ws)
+    w   = ws(i);
+    if ~isempty(w.win)
+      win = w.win;
+    else
+      dummy = specwin(w.type, 100);
+      win = dummy.win;
+    end
+    hl  = [hl plot(win)];
+    col = colors{mod(i-1,length(colors))+1};
+    set(hl(end), 'Color', col);
+    xlabel('sample');
+    ylabel('amplitude');
+    titleStr = [titleStr, utils.prog.label(w.type), ', '];
+    lstr = [sprintf('alpha = %g\n', w.alpha)...
+      sprintf('psll = %g\n', w.psll)...
+      sprintf('rov = %g\n', w.rov)...
+      sprintf('nenbw = %g\n', w.nenbw)...
+      sprintf('w3db = %g\n', w.w3db)...
+      sprintf('flatness = %g\n', w.flatness)];
+    legendStr = [legendStr cellstr(lstr)];
+  end
+
+  legend(legendStr);
+  titleStr = titleStr(1:end-2);
+  title(sprintf('Window: %s', titleStr));
+
+  if nargout > 0
+    varargout{1} = hl;
+  end
+
+  hold off
+end
+