-
Notifications
You must be signed in to change notification settings - Fork 0
/
smac_view_frf.m
278 lines (240 loc) · 8.56 KB
/
smac_view_frf.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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
function fig=smac_view_frf(action,varargin)
% SMAC_VIEW_FRF Allow user to select and display FRF
%
% FIG=SMAC_VIEW_FRF
%
% SMAC_VIEW_FRF lets the user select FRF from the list on the left, and
% plots the modulus of the FRF in the axis. It overlays the FRF if
% multiple entries are selected.
%
% FIG is the handle of the GUI figure.
%==========================================================================
%
% ********************************************************************
% *** Copyright (C) 2008 Sandia Corporation. ***
% *** ***
% *** Under the terms of Contract DE-AC04-94AL85000 with Sandia ***
% *** Corporation, the U.S. Government retains certain rights in ***
% *** this software. ***
% ********************************************************************
%
% The contents of this file are subject to the Mozilla Public License
% Version 1.1 (the "License"); you may not use this file except in
% compliance with the License. You may obtain a copy of the License at
%
% http://www.mozilla.org/MPL/
%
% Software distributed under the License is distributed on an "AS IS"
% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
% License for the specific language governing rights and limitations under
% the License.
%
% The Original Code is SMAC.
%
% The Initial Developer of the Original Code is Randy Mayes.
% All Rights Reserved.
%
% Contributor(s): Dan Hensley / ATA Engineering.
%==========================================================================
% HISTORY
% 14-May-2004 / ATA Engineering / Dan Hensley
% o Modify view_frf1 into this format
% o Turn into function with action switchyard
% o Add descriptive function help
%
% 19-May-2004 / ATA Engineering / Dan Hensley
% o Update to new structure format
%
% 21-May-2004 / ATA Engineering / Dan Hensley
% o Support optional input argument for frequency range field
%
% 03-Jun-2004 / ATA Engineering / Dan Hensley
% o Make sure this looks good at any resolution
%
% 14-Jun-2004 / ATA Engineering / Dan Hensley
% o Make listbox fonts bigger
%
% 07-Jun-2005 / ATA Engineering / Dan Hensley
% o Use new GUI functions in uiWidgets
%
% TO DO:
% o Clean up GUI placement, text, etc.
% o See if we can IMATize this
% o Add help
%
%==========================================================================
f=imat_fn([]);
% Check input arguments
if ~exist('action','var') | isempty(action),
action='initialize';
end
if isa(action,'imat_fn'),
varargin={action, varargin{:}};
action='initialize';
end
%==========================================================================
% Action switchyard
switch action
%------------------------------------------------------------------------
case 'initialize',
ui=uiWidgets;
uip=ui.GetParams();
% Get the list of FRFs to display
if ~isempty(varargin),
f=varargin{1};
end
% Draw the figure
h0 = figure('Units','normalized', ...
'Color',uip.Form.Color, ...
...%'Colormap',mat0, ...
...%'FileName','/export/home/seklenk/codes/smac_pac/view_frf1.m', ...
'Name','FRF Plot Viewer', ...
...'PaperPosition',[18 180 576 432], ...
...'PaperUnits','points', ...
'Position',[0.00390625 0.3463541666666666 0.48046875 0.51171875], ...
'NumberTitle','off', ...
'Tag','Fig1', ...
'MenuBar','none', ...
'ToolBar','none');
h1 = uicontrol('Parent',h0, ...
'Units','normalized', ...
'BackgroundColor',[1 1 1], ...
'FontName','Courier New', ...
'FontWeight','bold', ...
'FontSize',10, ...
...'ForegroundColor',[0 0 1], ...
...'Max',172, ...
'Position',[0.03455284552845529 0.272264631043257 0.201219512195122 0.6284987277353689], ...
...'String',mat1, ...
'String','', ...
'Style','listbox', ...
'Tag','plot_lister', ...
'Value',[]);
setappdata(h0,'ListBoxHandle',h1);
% Fill in the listbox with reference and response coordinates
if ~isempty(f),
set(h1,'String',strcat(f.referencecoord,',',f.responsecoord));
set(h1,'Max',prod(size(f)));
end
h1 = uicontrol('Parent',h0, ...
'Units','normalized', ...
'BackgroundColor',[0.8 0.8 0.8], ...
...'BackgroundColor',[0.301 0.819 0.819], ...
'FontSize',12, ...
'FontWeight','bold', ...
...'ForegroundColor',[1 0 0], ...
'ListboxTop',0, ...
'Position',[0.03455284552845529 0.9109414758269719 0.1971544715447155 0.05089058524173028], ...
'String','Channel ID', ...
'Style','text', ...
'Tag','StaticText1');
h1 = uicontrol('Parent',h0, ...
'Units','normalized', ...
...'BackgroundColor',[0 1 1], ...
'Callback','close', ...
'FontSize',12, ...
'FontWeight','bold', ...
...'ForegroundColor',[1 0 0], ...
'ListboxTop',0, ...
'Position',[0.7825 0.0331 0.1809 0.0763], ...
'String','Done', ...
'Tag','Pushbutton1');
h1 = uicontrol('Parent',h0, ...
'Units','normalized', ...
...'BackgroundColor',[0 1 1], ...
'Callback','smac_view_frf(''plot'',gcbf)', ...
'FontWeight','bold', ...
...'ForegroundColor',[0 0 1], ...
'ListboxTop',0, ...
'Position',[0.03455284552845529 0.1908396946564885 0.1971544715447155 0.05852417302798981], ...
'String','Plot', ...
'Tag','plotter1');
colororder=[...
0 0 1.0000; ...
0 0.5000 0; ...
1.0000 0 0; ...
0 0.7500 0.7500; ...
0.7500 0 0.7500; ...
0.7500 0.7500 0; ...
0.2500 0.2500 0.2500 ];
h1 = axes('Parent',h0, ...
...'CameraUpVector',[0 1 0], ...
...'CameraUpVectorMode','manual', ...
'Color',[1 1 1], ...
'ColorOrder',colororder, ...
'Position',[0.3475609756097561 0.2010178117048345 0.6158536585365855 0.7608142493638678], ...
'Tag','Axes1', ...
...'XColor',[0 0 0], ...
...'YColor',[0 0 0], ...
'ZColor',[0 0 0]);
setappdata(h0,'AxisHandle',h1);
% h2 = text('Parent',h1, ...
% 'Color',[0 0 0], ...
% 'HandleVisibility','off', ...
% 'HorizontalAlignment','center', ...
% 'Position',[0.4966887417218543 -0.07718120805369133 9.160254037844386], ...
% 'Tag','Axes1Text4', ...
% 'VerticalAlignment','cap');
% set(get(h2,'Parent'),'XLabel',h2);
% h2 = text('Parent',h1, ...
% 'Color',[0 0 0], ...
% 'HandleVisibility','off', ...
% 'HorizontalAlignment','center', ...
% 'Position',[-0.09271523178807944 0.4966442953020134 9.160254037844386], ...
% 'Rotation',90, ...
% 'Tag','Axes1Text3', ...
% 'VerticalAlignment','baseline');
% set(get(h2,'Parent'),'YLabel',h2);
% h2 = text('Parent',h1, ...
% 'Color',[0 0 0], ...
% 'HandleVisibility','off', ...
% 'HorizontalAlignment','right', ...
% 'Position',[-0.5695364238410595 1.046979865771812 9.160254037844386], ...
% 'Tag','Axes1Text2', ...
% 'Visible','off');
% set(get(h2,'Parent'),'ZLabel',h2);
% h2 = text('Parent',h1, ...
% 'Color',[0 0 0], ...
% 'HandleVisibility','off', ...
% 'HorizontalAlignment','center', ...
% 'Position',[0.4966887417218543 1.020134228187919 9.160254037844386], ...
% 'Tag','Axes1Text1', ...
% 'VerticalAlignment','bottom');
% set(get(h2,'Parent'),'Title',h2);
setappdata(h0,'FRF',f);
if length(varargin)>1,
setappdata(h0,'FreqIndexField',varargin{2});
else
setappdata(h0,'FreqIndexField','freqrange');
end
if nargout > 0, fig = h0; end
%------------------------------------------------------------------------
case 'plot'
h=varargin{1};
hl=getappdata(h,'ListBoxHandle');
ha=getappdata(h,'AxisHandle');
hff=getappdata(h,'FreqIndexField');
f=getappdata(h,'FRF');
% Figure out which functions to plot
ind=get(hl,'Value');
if ~isempty(ind),
global ss
fa=ss.fe(ind(1)).abscissa;
fo=ss.fe(ind).ordinate;
if ~isempty(ss.freqrange),
fa=fa(ss.(hff)(1,2):ss.(hff)(2,2));
fo=fo(ss.(hff)(1,2):ss.(hff)(2,2),:);
end
% Plot the data and set the labels
semilogy(fa,abs(fo))
xlabel('Frequency (Hz)');
ylabel('FRF Magnitude');
set(gca,'XGrid','on');
% Set the X axis limits
xlim(ss.(hff)(:,1));
end
%------------------------------------------------------------------------
otherwise
uiwait(errordlg(sprintf('Unknown action ''%s''',action)));
end
%=