From: <par...@us...> - 2012-09-13 17:51:09
|
Revision: 11004 http://octave.svn.sourceforge.net/octave/?rev=11004&view=rev Author: paramaniac Date: 2012-09-13 17:50:58 +0000 (Thu, 13 Sep 2012) Log Message: ----------- control: first draft code for multiplot nyquist Modified Paths: -------------- trunk/octave-forge/main/control/NEWS trunk/octave-forge/main/control/devel/bode2.m trunk/octave-forge/main/control/devel/multiplot.m Added Paths: ----------- trunk/octave-forge/main/control/devel/nyquist2.m Modified: trunk/octave-forge/main/control/NEWS =================================================================== --- trunk/octave-forge/main/control/NEWS 2012-09-13 16:47:24 UTC (rev 11003) +++ trunk/octave-forge/main/control/NEWS 2012-09-13 17:50:58 UTC (rev 11004) @@ -11,8 +11,11 @@ ** sensitivity Fixed a problem where an error was raised about an undefined function "issiso". - +** All SLICOT function names have now leading and trailing underscores to + emphasize their private nature. + + =============================================================================== control-2.3.53 Release Date: 2012-08-27 Release Manager: Lukas Reichlin =============================================================================== Modified: trunk/octave-forge/main/control/devel/bode2.m =================================================================== --- trunk/octave-forge/main/control/devel/bode2.m 2012-09-13 16:47:24 UTC (rev 11003) +++ trunk/octave-forge/main/control/devel/bode2.m 2012-09-13 17:50:58 UTC (rev 11004) @@ -94,7 +94,7 @@ else mag_r = mag{1}; pha_r = pha{1}; - w_r = w; + w_r = w{1}; endif endfunction \ No newline at end of file Modified: trunk/octave-forge/main/control/devel/multiplot.m =================================================================== --- trunk/octave-forge/main/control/devel/multiplot.m 2012-09-13 16:47:24 UTC (rev 11003) +++ trunk/octave-forge/main/control/devel/multiplot.m 2012-09-13 17:50:58 UTC (rev 11004) @@ -9,4 +9,8 @@ % bode2 (5*C_AH, frd (C_AH, 1:10), frd (C_opt, 11:20)) figure (3) -bode2 (5*C_AH, '*r', C_AH, ':b', C_opt, '-.k') \ No newline at end of file +bode2 (5*C_AH, '*r', C_AH, 'xb', C_opt, 'ok') + + +figure (4) +nyquist2 (C_AH, C_opt) \ No newline at end of file Added: trunk/octave-forge/main/control/devel/nyquist2.m =================================================================== --- trunk/octave-forge/main/control/devel/nyquist2.m (rev 0) +++ trunk/octave-forge/main/control/devel/nyquist2.m 2012-09-13 17:50:58 UTC (rev 11004) @@ -0,0 +1,85 @@ +## Copyright (C) 2009, 2010, 2012 Lukas F. Reichlin +## +## This file is part of LTI Syncope. +## +## LTI Syncope is free software: you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation, either version 3 of the License, or +## (at your option) any later version. +## +## LTI Syncope is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with LTI Syncope. If not, see <http://www.gnu.org/licenses/>. + +## -*- texinfo -*- +## @deftypefn {Function File} {[@var{re}, @var{im}, @var{w}] =} nyquist (@var{sys}) +## @deftypefnx {Function File} {[@var{re}, @var{im}, @var{w}] =} nyquist (@var{sys}, @var{w}) +## Nyquist diagram of frequency response. If no output arguments are given, +## the response is printed on the screen. +## +## @strong{Inputs} +## @table @var +## @item sys +## LTI system. Must be a single-input and single-output (SISO) system. +## @item w +## Optional vector of frequency values. If @var{w} is not specified, +## it is calculated by the zeros and poles of the system. +## Alternatively, the cell @code{@{wmin, wmax@}} specifies a frequency range, +## where @var{wmin} and @var{wmax} denote minimum and maximum frequencies +## in rad/s. +## @end table +## +## @strong{Outputs} +## @table @var +## @item re +## Vector of real parts. Has length of frequency vector @var{w}. +## @item im +## Vector of imaginary parts. Has length of frequency vector @var{w}. +## @item w +## Vector of frequency values used. +## @end table +## +## @seealso{bode, nichols, sigma} +## @end deftypefn + +## Author: Lukas Reichlin <luk...@gm...> +## Created: November 2009 +## Version: 0.4 + +function [re_r, im_r, w_r] = nyquist2 (varargin) + + if (nargin == 0) + print_usage (); + endif + + [H, w] = __frequency_response_2__ (varargin, false, 0, "ext"); + + H = cellfun (@reshape, H, {[]}, {1}, "uniformoutput", false); + re = cellfun (@real, H, "uniformoutput", false); + 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}, "-."); + endfor + + plot (args{:}) + axis ("tight") + xlim (__axis_margin__ (xlim)) + ylim (__axis_margin__ (ylim)) + grid ("on") + title ("Nyquist Diagram") + xlabel ("Real Axis") + ylabel ("Imaginary Axis") + else + re_r = re{1}; + im_r = im{1}; + w_r = w{1}; + endif + +endfunction \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |