forked from wozy13/DIAMOND
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cebtns.m
231 lines (208 loc) · 7.38 KB
/
cebtns.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
function cebtns
% Function: cebtns.m
%
% Usage: cebtns
%
% Description:
% Initializes the Complex Exponential Window
% Handles and graphics elements.
% Returns a vector to those elements.
%
% Version SWD970804
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 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 HANDLES
%====================================
% General buttons parameters
%====================================
top=.95;
left=.84;
btnwd=.15;
btnht=.06;
spacing=.01;
%====================================
% Set up the console frame
%=====================================
frmborder=0.01;
ypos=.05-frmborder;
frmpos=[left-frmborder ypos btnwd+2*frmborder .9+2*frmborder];
HANDLES.hceb(1)=uicontrol(HANDLES.hfigdmnd, ...
'Style','Frame', ...
'Position',frmpos, ...
'BackgroundColor',[.5 .5 .5]);
%====================================
% Set up the axes
%====================================
HANDLES.hceb(16) = axes('position',[.1 .2 .7 .7]);
%====================================
% Set up the cursors
%====================================
HANDLES.hceb(12) = line([0 0],[0 0]);
HANDLES.hceb(13) = text(0,0,'');
HANDLES.hceb(14) = line([0 0],[0 0]);
HANDLES.hceb(15) = text(0,0,'');
%==================================
% Set up buttons
%==================================
%
% Plot tools button
%
btnnum=1;
ypos=top-(btnnum-1)*(btnht+spacing);
btnpos=[left ypos-btnht btnwd btnht];
HANDLES.hceb(2)=uicontrol(HANDLES.hfigdmnd, ...
'style','push', ...
'position',btnpos, ...
'string','Plot Tools', ...
'callback',['eval(get(hplttl(11),''call'')),',...
'set(hplttl(1),''visible'',''on''), figure(hplttl(1))']);
%==================================
% Set up buttons
%==================================
%
% Run Complex Exponential Algorithm
%
btnnum=2.5;
ypos=top-(btnnum-1)*(btnht);
btnpos=[left ypos-btnht btnwd btnht];
HANDLES.hceb(3)=uicontrol(HANDLES.hfigdmnd, ...
'style','push', ...
'unit','normalized', ...
'position',btnpos, ...
'visible','off', ...
'string','Run Comp Exp', ...
'callback',[ ...
'm=str2num(get(onHndlVector(5),''string''));', ...
'delta_f = sp / (nlines-1);',...
'[Y, this_lambda, freq_t, damp_t, fs_out,err] = ',...
' compexp(G,nlines,delta_f,f1,f2,fs,m,iref,iresp);', ...
'if err==0,',...
' fprintf(1,''\n\nFreq (Hz):\n'');',...
' fprintf(1,''%10.5f\n'',freq_t);', ...
' fprintf(1,''\n\nDamp (%%):\n'');',...
' fprintf(1,''%10.5f\n'',damp_t*100);', ...
'end']);
%
% Order
%
btnnum=3.5;
ypos=top-(btnnum-1)*(btnht);
btnpos=[left ypos-btnht btnwd*.6 btnht];
HANDLES.hceb(4)=uicontrol(HANDLES.hfigdmnd, ...
'style','text', ...
'unit','normalized', ...
'position',btnpos, ...
'visible','off', ...
'string','Order');
btnpos=[left+.6*btnwd ypos-btnht btnwd*.4 btnht];
HANDLES.hceb(5)=uicontrol(HANDLES.hfigdmnd, ...
'style','edit', ...
'unit','normalized', ...
'position',btnpos, ...
'visible','off', ...
'string','?');
%
% sliders
%
%
% Lower frequency
%
HANDLES.hceb(6) = uicontrol(HANDLES.hfigdmnd, ...
'style','slider', ...
'pos',[.13 .01 .2 0.04], ...
'back','w', ...
'value',1, ...
'max',100, ...
'min',0, ...
'userdata',1, ...
'call',['f1_t=get(onHndlVector(6),''value'');',...
'[f1,onHndlVector(12:13)] = slidfreq(f1_t,onHndlVector(6),',...
'onHndlVector(12:13),onHndlVector(16),ymaxm,yminm,lnst(2,:),lnco(2,:));',...
'set(onHndlVector(8),''string'',num2str(f1));',...
' hline(2) = onHndlVector(12);']);
HANDLES.hceb(7)=uicontrol(HANDLES.hfigdmnd, ...
'style','text', ...
'pos',[.13 .05 .1 .04], ...
'string','Lower');
HANDLES.hceb(8)=uicontrol(HANDLES.hfigdmnd, ...
'style','edit', ...
'pos',[.23 .05 .1 .04], ...
'string','fminm', ...
'back','w', ...
'callback',['f1_t=str2num(get(onHndlVector(8),''string''));', ...
'[f1,onHndlVector(12:13)] = slidfreq(f1_t,onHndlVector(6),',...
'onHndlVector(12:13),onHndlVector(16),ymaxm,yminm,lnst(2,:),lnco(2,:));',...
'set(onHndlVector(8),''string'',num2str(f1));',...
' hline(2) = onHndlVector(12);']);
%
% Upper frequency
%
HANDLES.hceb(9) = uicontrol(HANDLES.hfigdmnd, ...
'style','slider', ...
'pos',[.55 .01 .2 0.04], ...
'value',1, ...
'max',100, ...
'min',0, ...
'userdata',1, ...
'back','w', ...
'call',['f2_t=get(onHndlVector(9),''value'');',...
'[f2,onHndlVector(14:15)] = slidfreq(f2_t,onHndlVector(9),',...
'onHndlVector(14:15),onHndlVector(16),ymaxm,yminm,lnst(3,:),lnco(3,:));',...
'set(onHndlVector(11),''string'',num2str(f2));',...
'hline(3) = onHndlVector(14);']);
HANDLES.hceb(10)=uicontrol(HANDLES.hfigdmnd, ...
'style','text', ...
'pos',[.55 .05 .1 .04], ...
'string','upper');
HANDLES.hceb(11)=uicontrol(HANDLES.hfigdmnd, ...
'style','edit', ...
'back','w', ...
'pos',[.65 .05 .1 .04], ...
'string','temp', ...
'callback',['f2_t=str2num(get(onHndlVector(11),''string''));', ...
'[f2,onHndlVector(14:15)] = slidfreq(f2_t,onHndlVector(9),',...
'onHndlVector(14:15),onHndlVector(16),ymaxm,yminm,lnst(3,:),lnco(3,:));',...
'set(onHndlVector(11),''string'',num2str(f2));',...
'hline(3) = onHndlVector(14);']);
%
% Mouse-based cursor position
%
% Lower Freq.
HANDLES.hceb(17)=uicontrol(HANDLES.hfigdmnd, ...
'style','pushbutton', ...
'pos',[.13 .10 .2 .04], ...
'string','Use Mouse', ...
'callback',['[f1_t,temp] = ginput(1);',...
'[f1,onHndlVector(12:13)] = slidfreq(f1_t,onHndlVector(6),',...
'onHndlVector(12:13),onHndlVector(16),ymaxm,yminm,lnst(2,:),lnco(2,:));',...
'set(onHndlVector(8),''string'',num2str(f1));',...
'hline(2) = onHndlVector(12);']);
% Upper Freq.
HANDLES.hceb(18)=uicontrol(HANDLES.hfigdmnd, ...
'style','pushbutton', ...
'pos',[.55 .10 .2 .04], ...
'string','Use Mouse', ...
'callback',['[f2_t,temp] = ginput(1);',...
'[f2,onHndlVector(14:15)] = slidfreq(f2_t,onHndlVector(9),',...
'onHndlVector(14:15),onHndlVector(16),ymaxm,yminm,lnst(3,:),lnco(3,:));',...
'set(onHndlVector(11),''string'',num2str(f2));',...
'hline(3) = onHndlVector(14);']);
set(HANDLES.hceb,'visible','off')
return