-
Notifications
You must be signed in to change notification settings - Fork 0
/
URM_freq_response.m
39 lines (32 loc) · 939 Bytes
/
URM_freq_response.m
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
function [FR frq s] = URM_freq_response(data_filename,bt,ct,frq)
% [FR frq s] = URM_freq_response(data_filename,bt,ct,frq)
%
% compute the frequency response of the undreduced model for input values of frq
% via the original formulation
% H(s) = C' * (sE-A)^-1 * B
if ~exist('frq','var') || isempty(frq)
[s frq] = tfdomain();
end
SISO = exist('bt','var') & ~isempty(bt) & exist('ct','var') & ~isempty(ct);
npts = length(frq);
f1 = round(log10(frq(1)));
f2 = round(log10(frq(end)));
s = 2i*pi*frq;
if SISO
model_name = sprintf('%ss%d%d',data_filename,bt,ct);
else
model_name = data_filename;
end
FR_filename = sprintf('FR_%s_%d_%d_%d.mat',model_name,npts,f1,f2);
if exist(FR_filename,'file') == 2
vars = load(FR_filename);
FR = vars.FR;
else
if SISO
[A E C B] = realization(data_filename,bt,ct);
else
[A E C B] = realization(data_filename);
end
FR = transfer_function([],A,E,C,B,s);
save(FR_filename,'FR','frq');
end