Mercurial > hg > octave-nkf
diff scripts/control/nichols.m @ 3381:69b167451491
[project @ 1999-12-15 20:48:10 by jwe]
author | jwe |
---|---|
date | Wed, 15 Dec 1999 20:48:45 +0000 |
parents | f7e4a95916f2 |
children | d931332a73dc |
line wrap: on
line diff
--- a/scripts/control/nichols.m +++ b/scripts/control/nichols.m @@ -1,57 +1,58 @@ -# Copyright (C) 1998 Auburn University. All Rights Reserved -# -# This file is part of Octave. -# -# Octave 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 2, or (at your option) any -# later version. -# -# Octave 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 Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. +## Copyright (C) 1998 Auburn University. All Rights Reserved +## +## This file is part of Octave. +## +## Octave 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 2, or (at your option) any +## later version. +## +## Octave 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 Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. -function [mag,phase,w] = nichols(sys,w,outputs,inputs) -# [mag,phase,w] = nichols(sys[,w,outputs,inputs]) -# Produce Nichols plot of a system -# -# Compute the frequency response of a system. -# inputs: -# sys: system data structure (must be either purely continuous or discrete; +## [mag,phase,w] = nichols(sys[,w,outputs,inputs]) +## Produce Nichols plot of a system +## +## Compute the frequency response of a system. +## inputs: +## sys: system data structure (must be either purely continuous or discrete; # see is_digital) -# w: frequency values for evaluation. -# if sys is continuous, then nichols evaluates G(jw) -# if sys is discrete, then nichols evaluates G(exp(jwT)), where T=sys.tsam -# (the system sampling time) -# default: the default frequency range is selected as follows: (These -# steps are NOT performed if w is specified) -# (1) via routine bodquist, isolate all poles and zeros away from -# w=0 (jw=0 or exp(jwT)=1) and select the frequency -# range based on the breakpoint locations of the frequencies. -# (2) if sys is discrete time, the frequency range is limited -# to jwT in [0,2p*pi] -# (3) A "smoothing" routine is used to ensure that the plot phase does -# not change excessively from point to point and that singular -# points (e.g., crossovers from +/- 180) are accurately shown. -# outputs, inputs: the indices of the output(s) and input(s) to be used in -# the frequency response; see sysprune. -# outputs: -# mag, phase: the magnitude and phase of the frequency response -# G(jw) or G(exp(jwT)) at the selected frequency values. -# w: the vector of frequency values used -# If no output arguments are given, nichols plots the results to the screen. -# Descriptive labels are automatically placed. See xlabel, ylable, title, -# and replot. -# -# Note: if the requested plot is for an MIMO system, mag is set to -# ||G(jw)|| or ||G(exp(jwT))|| and phase information is not computed. +## w: frequency values for evaluation. +## if sys is continuous, then nichols evaluates G(jw) +## if sys is discrete, then nichols evaluates G(exp(jwT)), where T=sys.tsam +## (the system sampling time) +## default: the default frequency range is selected as follows: (These +## steps are NOT performed if w is specified) +## (1) via routine bodquist, isolate all poles and zeros away from +## w=0 (jw=0 or exp(jwT)=1) and select the frequency +## range based on the breakpoint locations of the frequencies. +## (2) if sys is discrete time, the frequency range is limited +## to jwT in [0,2p*pi] +## (3) A "smoothing" routine is used to ensure that the plot phase does +## not change excessively from point to point and that singular +## points (e.g., crossovers from +/- 180) are accurately shown. +## outputs, inputs: the indices of the output(s) and input(s) to be used in +## the frequency response; see sysprune. +## outputs: +## mag, phase: the magnitude and phase of the frequency response +## G(jw) or G(exp(jwT)) at the selected frequency values. +## w: the vector of frequency values used +## If no output arguments are given, nichols plots the results to the screen. +## Descriptive labels are automatically placed. See xlabel, ylable, title, +## and replot. +## +## Note: if the requested plot is for an MIMO system, mag is set to +## ||G(jw)|| or ||G(exp(jwT))|| and phase information is not computed. - # check number of input arguments given +function [mag,phase,w] = nichols(sys,w,outputs,inputs) + + ## check number of input arguments given if (nargin < 1 | nargin > 4) usage("[mag,phase,w] = nichols(sys[,w,outputs,inputs])"); endif @@ -70,12 +71,12 @@ [stname,inname,outname] = sysgetsignals(sys); systsam = sysgettsam(sys); - # Get the magnitude and phase of f. + ## Get the magnitude and phase of f. mag = abs(f); phase = arg(f)*180.0/pi; if (nargout < 1), - # Plot the information + ## Plot the information if(gnuplot_has_multiplot) oneplot(); endif