1 ## Copyright (C) 2010, 2011, 2012 Lukas F. Reichlin
3 ## This file is part of LTI Syncope.
5 ## LTI Syncope is free software: you can redistribute it and/or modify
6 ## it under the terms of the GNU General Public License as published by
7 ## the Free Software Foundation, either version 3 of the License, or
8 ## (at your option) any later version.
10 ## LTI Syncope is distributed in the hope that it will be useful,
11 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 ## GNU General Public License for more details.
15 ## You should have received a copy of the GNU General Public License
16 ## along with LTI Syncope. If not, see <http://www.gnu.org/licenses/>.
19 ## @deftypefn {Function File} {[@var{H}, @var{w}, @var{tsam}] =} frdata (@var{sys})
20 ## @deftypefnx {Function File} {[@var{H}, @var{w}, @var{tsam}] =} frdata (@var{sys}, @var{"vector"})
21 ## Access frequency response data.
22 ## Argument @var{sys} is not limited to frequency response data objects.
23 ## If @var{sys} is not a frd object, it is converted automatically.
28 ## Any type of LTI model.
29 ## @item "v", "vector"
30 ## In case @var{sys} is a SISO model, this option returns the frequency response
31 ## as a column vector (lw-by-1) instead of an array (p-by-m-by-lw).
37 ## Frequency response array (p-by-m-by-lw). H(i,j,k) contains the
38 ## response from input j to output i at frequency k. In the SISO case,
39 ## a vector (lw-by-1) is possible as well.
41 ## Frequency vector (lw-by-1) in radian per second [rad/s].
42 ## Frequencies are in ascending order.
44 ## Sampling time in seconds. If @var{sys} is a continuous-time model,
45 ## a zero is returned.
49 ## Author: Lukas Reichlin <lukas.reichlin@gmail.com>
50 ## Created: October 2010
53 function [H, w, tsam] = frdata (sys, rtype = "array")
55 if (! isa (sys, "frd"))
59 [H, w] = __sys_data__ (sys);
63 if (strncmpi (rtype, "v", 1) && issiso (sys))
64 H = reshape (H, [], 1);