-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathdefspecdatavec.m
164 lines (154 loc) · 7.16 KB
/
defspecdatavec.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
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
function defspecdatavec(iaxes)
%
% Name: defspecdatavec
%
% Usage: defspecdatavec(iaxes)
%
% Defines the fields 'specdatavec' in the global
% variable DISPLAY
%
% iaxes = index of current axes
%
%
% Version SWD970819
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% This matlab source code was originally %
% developed as part of "DIAMOND" at %
% Los Alamos National Laboratory. It may %
% be copied, modified, and distributed in %
% any form, provided: %
% a) This notice accompanies the files and %
% appears near the top of all source %
% code files. %
% b) No payment or commercial services are %
% received in exchange for the code. %
% %
% Original copyright is reserved by the %
% Regents of the University of California, %
% in addition to Scott W. Doebling, Phillip %
% J. Cornwell, Erik G. Straser, and Charles %
% R. Farrar. %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
global DISPLAY DATA MODES indsvec
j = sqrt(-1);
% Procedure for defining each specdatavec:
% Extract the number of the datafile that contains this data
% Extract the ensemble average number of the data to display
% Extract the appropriate data function from the DATA variable
switch DISPLAY{iaxes}.ioverlay,
case 0, % No Overlay
indsvec = 1;
inds = 1;
iavg = DISPLAY{iaxes}.iavg{inds};
idf = DISPLAY{iaxes}.idatafile{inds};
switch DISPLAY{iaxes}.specfun{inds}
case 'FRF', DISPLAY{iaxes}.specdatavec{inds} = DATA{idf}.G(:,:,:,iavg); %FRF
case 'Coherence', DISPLAY{iaxes}.specdatavec{inds} = DATA{idf}.Coh(:,:,:,iavg); DISPLAY{iaxes}.displayfun{inds} = 'SISO'; %COH
case 'CPS', DISPLAY{iaxes}.specdatavec{inds} = DATA{idf}.Gxy(:,:,:,iavg); %CPS
case 'PSD Resp', DISPLAY{iaxes}.specdatavec{inds} = DATA{idf}.Gyy(:,:,iavg); DISPLAY{iaxes}.displayfun{inds} = 'SISO'; %PSD Resp
case 'PSD Ref', DISPLAY{iaxes}.specdatavec{inds} = DATA{idf}.Gxx(:,:,iavg); DISPLAY{iaxes}.displayfun{inds} = 'SISO'; %PSD Ref
case 'Time History', DISPLAY{iaxes}.specdatavec{inds} = DATA{idf}.thist(:,:,:,iavg); %Time History
end
case 1, % Secondary data Overlay
indsvec = [1 2];
for inds = indsvec,
iavg = DISPLAY{iaxes}.iavg{inds};
idf = DISPLAY{iaxes}.idatafile{inds};
switch DISPLAY{iaxes}.specfun{inds}
case 'FRF', DISPLAY{iaxes}.specdatavec{inds} = DATA{idf}.G(:,:,:,iavg); %FRF
case 'Coherence', DISPLAY{iaxes}.specdatavec{inds} = DATA{idf}.Coh(:,:,:); DISPLAY{iaxes}.displayfun{inds} = 'SISO'; %COH
case 'CPS', DISPLAY{iaxes}.specdatavec{inds} = DATA{idf}.Gxy(:,:,:,iavg); %CPS
case 'PSD Resp', DISPLAY{iaxes}.specdatavec{inds} = DATA{idf}.Gyy(:,:,iavg); DISPLAY{iaxes}.displayfun{inds} = 'SISO'; %PSD Resp
case 'PSD Ref', DISPLAY{iaxes}.specdatavec{inds} = DATA{idf}.Gxx(:,:,iavg); DISPLAY{iaxes}.displayfun{inds} = 'SISO'; %PSD Ref
case 'Time History', DISPLAY{iaxes}.specdatavec{inds} = DATA{idf}.thist(:,:,:,iavg); %Time History
end
end
inds = 1;
case 2, % Statistical overlay
indsvec = [1 2 3];
inds = 1;
idf = DISPLAY{iaxes}.idatafile{1};
iavg = DISPLAY{iaxes}.iavg{1};
inumsig = DISPLAY{iaxes}.inumsig;
coh1sig = DATA{idf}.coh1sig;
cps1sig = DATA{idf}.cps1sig;
switch DISPLAY{iaxes}.specfun{1},
% Define Mean, (mean + confidence interval), and (mean - confidence interval)
case 'FRF',
mag1sig = DATA{idf}.mag1sig;
phs1sig = DATA{idf}.phs1sig;
mag = abs(DATA{idf}.G(:,:,:,iavg));
phs = angle(DATA{idf}.G(:,:,:,iavg));
j = sqrt(-1);
DISPLAY{iaxes}.specdatavec{1} = DATA{idf}.G(:,:,:,iavg);
DISPLAY{iaxes}.specdatavec{2}= (mag + inumsig*mag1sig) .* exp(j*phs + inumsig*phs1sig);
DISPLAY{iaxes}.specdatavec{3} = (mag - inumsig*mag1sig) .* exp(j*phs - inumsig*phs1sig);
case 'Coherence',
coh1sig = DATA{idf}.coh1sig;
DISPLAY{iaxes}.specdatavec{1} = DATA{idf}.Coh(:,:,:);
DISPLAY{iaxes}.specdatavec{2} = DATA{idf}.Coh(:,:,:) + inumsig*coh1sig;
DISPLAY{iaxes}.specdatavec{3} = DATA{idf}.Coh(:,:,:) - inumsig*coh1sig;
DISPLAY{iaxes}.displayfun{inds} = 'SISO';
case 'CPS',
cps1sig = DATA{idf}.cps1sig;
DISPLAY{iaxes}.specdatavec{1} = DATA{idf}.Gxy(:,:,:,iavg);
DISPLAY{iaxes}.specdatavec{2} = DATA{idf}.Gxy(:,:,:,iavg) + inumsig*cps1sig;
DISPLAY{iaxes}.specdatavec{3} = DATA{idf}.Gxy(:,:,:,iavg) - inumsig*cps1sig;
case 'PSD Resp', DISPLAY{iaxes}.specdatavec{1} = DATA{idf}.Gyy(:,:,iavg); indsvec = 1; DISPLAY{iaxes}.displayfun{inds} = 'SISO'; %PSD Resp
case 'PSD Ref', DISPLAY{iaxes}.specdatavec{1} = DATA{idf}.Gxx(:,:,iavg); indsvec = 1; DISPLAY{iaxes}.displayfun{inds} = 'SISO'; %PSD Ref
case 'Time History', DISPLAY{iaxes}.specdatavec{inds} = DATA{idf}.thist(:,:,:,iavg); %Time History
end
case 3, % Overlay synthesized FRF
indsvec = [1 2];
inds = 1;
idf = DISPLAY{iaxes}.idatafile{1};
iavg = DISPLAY{iaxes}.iavg{inds};
switch DISPLAY{iaxes}.specfun{1},
case 'FRF',
DISPLAY{iaxes}.specdatavec{1} = DATA{idf}.G(:,:,:,iavg);
DISPLAY{iaxes}.specdatavec{2} = zeros(size(DISPLAY{iaxes}.specdatavec{1}));
for imode = 1:MODES.nmodes,
pole = -MODES.Damp{imode} * 2*pi*MODES.Freq{imode} + ...
j * 2*pi*MODES.Freq{imode} * sqrt(1-MODES.Damp{imode}^2);
for iref = 1:size(MODES.residue{imode},1),
for iresp = 1:size(MODES.residue{imode},2),
DISPLAY{iaxes}.specdatavec{2}(:,iresp,iref) = DISPLAY{iaxes}.specdatavec{2}(:,iresp,iref) + ...
(MODES.residue{imode}(iref,iresp)./(j*DISPLAY{iaxes}.xvec.'*2*pi - pole) + ...
conj(MODES.residue{imode}(iref,iresp))./(j*DISPLAY{iaxes}.xvec.'*2*pi - conj(pole))) .* (DISPLAY{iaxes}.xvec.'*2*pi).^2;
%/ 9.81^2; % ASSUMES ACCEL FRFs
end
end
end
case 'Coherence',
DISPLAY{iaxes}.specdatavec{1} = DATA{idf}.Coh(:,:,:);
% DISPLAY{iaxes}.specdatavec{2} =
DISPLAY{iaxes}.displayfun{inds} = 'SISO';
case 'CPS',
DISPLAY{iaxes}.specdatavec{1} = DATA{idf}.Gxy(:,:,:,iavg);
% DISPLAY{iaxes}.specdatavec{2} =
case 'PSD Resp',
DISPLAY{iaxes}.specdatavec{1} = DATA{idf}.Gyy(:,:,iavg);
% DISPLAY{iaxes}.specdatavec{2} =
DISPLAY{iaxes}.displayfun{inds} = 'SISO';
case 'PSD Ref',
DISPLAY{iaxes}.specdatavec{1} = DATA{idf}.Gxx(:,:,iavg);
% DISPLAY{iaxes}.specdatavec{2} =
DISPLAY{iaxes}.displayfun{inds} = 'SISO';
end
end
% Define the vector of x-coordinates for the display data
idf = DISPLAY{iaxes}.idatafile{inds};
switch DISPLAY{iaxes}.specfun{1},
case 'Time History',
t0 = DATA{idf}.t0;
t1 = DATA{idf}.t1;
ntim = size(DATA{idf}.thist,1);
DISPLAY{iaxes}.xvec = linspace(t0,t1 - (t1-t0)/ntim,ntim);
otherwise
cf = DATA{idf}.cf;
sp = DATA{idf}.sp;
nlines = DATA{idf}.nlines;
DISPLAY{iaxes}.xvec = linspace(cf-sp/2,cf+sp/2,nlines);
end
return