1 ## Copyright (C) 2010 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 ## Common code for adjusting FRD model data.
20 ## Used by @frd/frd.m and @frd/__set__.m
22 ## Author: Lukas Reichlin <lukas.reichlin@gmail.com>
23 ## Created: October 2010
26 function [H, w] = __adjust_frd_data__ (H, w);
28 w = reshape (w, [], 1);
31 if (ndims (H) != 3 && ! isempty (H))
33 H = reshape (H, 1, 1, []);
35 H = repmat (H, [1, 1, lw]); # needed for "frd1 + scalar2" or "scalar1 * frd2)
37 elseif (isvector (H) && length (H) == lw) # SISO system (H is a vector)
38 H = reshape (H, 1, 1, []);
40 H = reshape (H, rows (H), []);
42 H = repmat (H, [1, 1, lw]); # needed for "frd1 + matrix2" or "matrix1 * frd2)
45 error ("frd: first argument H invalid");