From: <par...@us...> - 2012-09-13 18:01:50
|
Revision: 11005 http://octave.svn.sourceforge.net/octave/?rev=11005&view=rev Author: paramaniac Date: 2012-09-13 18:01:43 +0000 (Thu, 13 Sep 2012) Log Message: ----------- control: add legend to multiplot nyquist Modified Paths: -------------- trunk/octave-forge/main/control/devel/nyquist2.m Modified: trunk/octave-forge/main/control/devel/nyquist2.m =================================================================== --- trunk/octave-forge/main/control/devel/nyquist2.m 2012-09-13 17:50:58 UTC (rev 11004) +++ trunk/octave-forge/main/control/devel/nyquist2.m 2012-09-13 18:01:43 UTC (rev 11005) @@ -63,12 +63,19 @@ im = cellfun (@imag, H, "uniformoutput", false); if (! nargout) - args = {}; - for k = 1 : numel (H) - args = cat (2, args, re{k}, im{k}, "-", re{k}, -im{k}, "-."); + tmp = cellfun (@isa, varargin, {"lti"}); + sys_idx = find (tmp); + + len = numel (H); + plot_args = {}; + legend_args = cell (len, 1); + + for k = 1:len + plot_args = cat (2, plot_args, re{k}, im{k}, "-", re{k}, -im{k}, "-."); + legend_args{k} = inputname(sys_idx(k)); endfor - plot (args{:}) + h = plot (plot_args{:}); axis ("tight") xlim (__axis_margin__ (xlim)) ylim (__axis_margin__ (ylim)) @@ -76,6 +83,7 @@ title ("Nyquist Diagram") xlabel ("Real Axis") ylabel ("Imaginary Axis") + legend (h(1:2:2*len), legend_args) else re_r = re{1}; im_r = im{1}; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |