X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?p=CreaPhase.git;a=blobdiff_plain;f=octave_packages%2Fcontrol-2.3.52%2F__frequency_response__.m;fp=octave_packages%2Fcontrol-2.3.52%2F__frequency_response__.m;h=351ffbb4b4b404857c8956920e96b0f375f99bdb;hp=0000000000000000000000000000000000000000;hb=f5f7a74bd8a4900f0b797da6783be80e11a68d86;hpb=1705066eceaaea976f010f669ce8e972f3734b05 diff --git a/octave_packages/control-2.3.52/__frequency_response__.m b/octave_packages/control-2.3.52/__frequency_response__.m new file mode 100644 index 0000000..351ffbb --- /dev/null +++ b/octave_packages/control-2.3.52/__frequency_response__.m @@ -0,0 +1,55 @@ +## 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 . + +## -*- texinfo -*- +## Return frequency response H and frequency vector w. +## If w is empty, it will be calculated by __frequency_vector__. + +## Author: Lukas Reichlin +## Created: November 2009 +## Version: 0.4 + +function [H, w] = __frequency_response__ (sys, w = [], mimoflag = 0, resptype = 0, wbounds = "std", cellflag = false) + + ## check arguments + if(! isa (sys, "lti")) + error ("frequency_response: first argument sys must be an LTI system"); + endif + + if (! mimoflag && ! issiso (sys)) + error ("frequency_response: require SISO system"); + endif + + if (isa (sys, "frd")) + if (! isempty (w)) + warning ("frequency_response: second argument w is ignored"); + endif + w = get (sys, "w"); + H = __freqresp__ (sys, [], resptype, cellflag); + elseif (isempty (w)) # find interesting frequency range w if not specified + w = __frequency_vector__ (sys, wbounds); + H = __freqresp__ (sys, w, resptype, cellflag); + elseif (iscell (w) && numel (w) == 2 && issample (w{1}) && issample (w{2})) + w = __frequency_vector__ (sys, wbounds, w{1}, w{2}); + H = __freqresp__ (sys, w, resptype, cellflag); + elseif (! is_real_vector (w)) + error ("frequency_response: second argument w must be a vector of frequencies"); + else + H = __freqresp__ (sys, w, resptype, cellflag); + endif + +endfunction