/usr/share/octave/packages/control-2.6.2/__frequency_response__.m is in octave-control 2.6.2-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | ## Copyright (C) 2009-2014 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 -*-
## Return frequency response H and frequency vector w.
## If w is empty, it will be calculated by __frequency_vector__.
## Author: Lukas Reichlin <lukas.reichlin@gmail.com>
## Created: November 2009
## Version: 0.5
function [H, w] = __frequency_response__ (args, mimoflag = false, wbounds = "std", cellflag = false)
isc = iscell (args);
if (! isc)
args = {args};
endif
sys_idx = cellfun (@isa, args, {"lti"}); # look for LTI models
w_idx = cellfun (@(x) is_real_vector (x) && length (x) > 1, args); # look for frequency vectors
r_idx = cellfun (@iscell, args); # look for frequency ranges {wmin, wmax}
sys_cell = args(sys_idx); # extract LTI models
frd_idx = cellfun (@isa, sys_cell, {"frd"}); # look for FRD models
## check arguments
if (! mimoflag && ! all (cellfun (@issiso, sys_cell)))
error ("frequency_response: require SISO systems");
endif
## determine frequencies
if (any (r_idx)) # if there are frequency ranges
r = args(r_idx){end}; # take the last one
if (numel (r) == 2 && issample (r{1}) && issample (r{2}))
w = __frequency_vector__ (sys_cell, wbounds, r{1}, r{2});
else
error ("frequency_response: invalid cell");
endif
elseif (any (w_idx)) # are there any frequency vectors?
w = args(w_idx){end};
w = repmat ({w}, 1, numel (sys_cell));
else # there are neither frequency ranges nor vectors
w = __frequency_vector__ (sys_cell, wbounds);
endif
w_frd = w(frd_idx); # temporarily save frequency vectors of FRD models
w(frd_idx) = {[]}; # freqresp returns all frequencies of FRD models for w=[]
## compute frequency response H for all LTI models
H = cellfun (@__freqresp__, sys_cell, w, {cellflag}, "uniformoutput", false);
## restore frequency vectors of FRD models in w
w(frd_idx) = w_frd;
if (! isc) # for old non-multiplot functions
H = H{1};
w = w{1};
endif
endfunction
|