source: ResearchApps/PHY/WARPLAB/WARPLab_v05_2/WorkshopExercises/warplab_mimo_2x2_GUI.m

Last change on this file was 1455, checked in by sgupta, 14 years ago

workshop exercises

File size: 33.8 KB
Line 
1function varargout = warplab_mimo_2x2_GUI(varargin)
2% WARPLAB_MIMO_2X2_GUI M-file for warplab_mimo_2x2_GUI.fig
3%      WARPLAB_MIMO_2X2_GUI, by itself, creates a new WARPLAB_MIMO_2X2_GUI or raises the existing
4%      singleton*.
5%
6%      H = WARPLAB_MIMO_2X2_GUI returns the handle to a new WARPLAB_MIMO_2X2_GUI or the handle to
7%      the existing singleton*.
8%
9%      WARPLAB_MIMO_2X2_GUI('CALLBACK',hObject,eventData,handles,...) calls the local
10%      function named CALLBACK in WARPLAB_MIMO_2X2_GUI.M with the given input arguments.
11%
12%      WARPLAB_MIMO_2X2_GUI('Property','Value',...) creates a new WARPLAB_MIMO_2X2_GUI or raises the
13%      existing singleton*.  Starting from the left, property value pairs are
14%      applied to the GUI before warplab_mimo_2x2_GUI_OpeningFunction gets called.  An
15%      unrecognized property name or invalid value makes property application
16%      stop.  All inputs are passed to warplab_mimo_2x2_GUI_OpeningFcn via varargin.
17%
18%      *See GUI Options on GUIDE's Tools menu.  Choose "GUI allows only one
19%      instance to run (singleton)".
20%
21% See also: GUIDE, GUIDATA, GUIHANDLES
22
23% Edit the above text to modify the response to help warplab_mimo_2x2_GUI
24
25% Last Modified by GUIDE v2.5 25-Jun-2008 14:28:38
26
27% Begin initialization code - DO NOT EDIT
28gui_Singleton = 1;
29gui_State = struct('gui_Name',       mfilename, ...
30                   'gui_Singleton',  gui_Singleton, ...
31                   'gui_OpeningFcn', @warplab_mimo_2x2_GUI_OpeningFcn, ...
32                   'gui_OutputFcn',  @warplab_mimo_2x2_GUI_OutputFcn, ...
33                   'gui_LayoutFcn',  [] , ...
34                   'gui_Callback',   []);
35if nargin && ischar(varargin{1})
36    gui_State.gui_Callback = str2func(varargin{1});
37end
38
39if nargout
40    [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
41else
42    gui_mainfcn(gui_State, varargin{:});
43end
44% End initialization code - DO NOT EDIT
45global warplab_mimo_2x2_GUI;
46warplab_mimo_2x2_GUIdefines;
47
48% --- Executes just before warplab_mimo_2x2_GUI is made visible.
49function warplab_mimo_2x2_GUI_OpeningFcn(hObject, eventdata, handles, varargin)
50% This function has no output args, see OutputFcn.
51% hObject    handle to figure
52% eventdata  reserved - to be defined in a future version of MATLAB
53% handles    structure with handles and user data (see GUIDATA)
54% varargin   command line arguments to warplab_mimo_2x2_GUI (see VARARGIN)
55
56% Choose default command line output for warplab_mimo_2x2_GUI
57handles.output = hObject;
58
59% Update handles structure
60guidata(hObject, handles);
61
62%Close any stale sockets
63pnet('closeall');
64
65global warplab_mimo_2x2_GUI;
66
67%Options
68warplab_mimo_2x2_GUI.CaptOffset = 0; %Number of noise samples per Rx capture; in [0:2^14]
69warplab_mimo_2x2_GUI.TxDelay = 0; %Number of noise samples per Rx capture; in [0:2^14]
70warplab_mimo_2x2_GUI.TxLength = 2^14-1; %Length of transmission; in [0:2^14-TxDelay]
71warplab_mimo_2x2_GUI.CarrierChannel = 8; % Channel in the 2.4 GHz band. In [1:14]
72warplab_mimo_2x2_GUI.TxA_BB = 3; %Tx Baseband Gain in [0:3]
73warplab_mimo_2x2_GUI.TxA_RF = 40; %Tx RF Gain in [0:63]
74warplab_mimo_2x2_GUI.RxA_BB = 13; %Rx Baseband Gain in [0:31]
75warplab_mimo_2x2_GUI.RxA_RF = 1; %Rx RF Gain in [1:3]
76warplab_mimo_2x2_GUI.TxB_BB = 3; %Tx Baseband Gain in [0:3]
77warplab_mimo_2x2_GUI.TxB_RF = 40; %Tx RF Gain in [0:63]
78warplab_mimo_2x2_GUI.RxB_BB = 13; %Rx Baseband Gain in [0:31]
79warplab_mimo_2x2_GUI.RxB_RF = 1; %Rx RF Gain in [1:3]
80warplab_mimo_2x2_GUI.TxSelect = 2;
81warplab_mimo_2x2_GUI.RxSelect = 2;
82
83axes(handles.axes_RAI)
84xlabel ('RxA I')
85% labels x-axis as RxA I
86% A implies Radio 2
87
88axes(handles.axes_RAQ)
89xlabel ('RxA Q')
90% labels x-axis as RxA Q
91% A implies Radio 2
92
93axes(handles.axes_RASpectrum)
94xlabel ('RxA Spectrum')
95% labels x-axis as RxA Spectrum
96% A implies Radio 2
97
98axes(handles.axes_RBI)
99xlabel ('RxB I')
100% labels x-axis as RxB I
101% B implies Radio 2
102
103axes(handles.axes_RBQ)
104xlabel ('RxB Q')
105% labels x-axis as RxB Q
106% B implies Radio 2
107
108axes(handles.axes_RBSpectrum)
109xlabel ('RxB Spectrum')
110% labels x-axis as RxB Spectrum
111% B implies Radio 2
112
113% --- Outputs from this function are returned to the command line.
114function varargout = warplab_mimo_2x2_GUI_OutputFcn(hObject, eventdata, handles) 
115% varargout  cell array for returning output args (see VARARGOUT);
116% hObject    handle to figure
117% eventdata  reserved - to be defined in a future version of MATLAB
118% handles    structure with handles and user data (see GUIDATA)
119
120% Get default command line output from handles structure
121varargout{1} = handles.output;
122
123
124
125function TxA_vector_Callback(hObject, eventdata, handles)
126% hObject    handle to TxA_vector (see GCBO)
127% eventdata  reserved - to be defined in a future version of MATLAB
128% handles    structure with handles and user data (see GUIDATA)
129
130% Hints: get(hObject,'String') returns contents of TxA_vector as text
131%        str2double(get(hObject,'String')) returns contents of TxA_vector as a double
132global warplab_mimo_2x2_GUI;
133warplab_mimo_2x2_GUIdefines;
134evalin('base','t = 0:25e-9:(2^14-1)*25e-9;');
135%define time variable
136warplab_mimo_2x2_GUI.radio2TxData = evalin('base',get(hObject,'String'));
137%define radio2TxData as string of vector
138
139
140% --- Executes during object creation, after setting all properties.
141function TxA_vector_CreateFcn(hObject, eventdata, handles)
142% hObject    handle to TxA_vector (see GCBO)
143% eventdata  reserved - to be defined in a future version of MATLAB
144% handles    empty - handles not created until after all CreateFcns called
145
146% Hint: edit controls usually have a white background on Windows.
147%       See ISPC and COMPUTER.
148if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
149    set(hObject,'BackgroundColor','white');
150end
151global warplab_mimo_2x2_GUI;
152warplab_mimo_2x2_GUIdefines;
153evalin('base','t = 0:25e-9:(2^14-1)*25e-9;');
154%define time variable
155warplab_mimo_2x2_GUI.radio2TxData = evalin('base',get(hObject,'String'));
156%define radio2TxData as string of vector
157
158
159
160function TxB_vector_Callback(hObject, eventdata, handles)
161% hObject    handle to TxB_vector (see GCBO)
162% eventdata  reserved - to be defined in a future version of MATLAB
163% handles    structure with handles and user data (see GUIDATA)
164
165% Hints: get(hObject,'String') returns contents of TxB_vector as text
166%        str2double(get(hObject,'String')) returns contents of TxB_vector as a double
167global warplab_mimo_2x2_GUI;
168warplab_mimo_2x2_GUIdefines;
169evalin('base','t = 0:25e-9:(2^14-1)*25e-9;');
170%define time variable
171warplab_mimo_2x2_GUI.radio3TxData = evalin('base',get(hObject,'String'));
172%define radio3TxData as string of vector
173
174
175
176% --- Executes during object creation, after setting all properties.
177function TxB_vector_CreateFcn(hObject, eventdata, handles)
178% hObject    handle to TxB_vector (see GCBO)
179% eventdata  reserved - to be defined in a future version of MATLAB
180% handles    empty - handles not created until after all CreateFcns called
181
182% Hint: edit controls usually have a white background on Windows.
183%       See ISPC and COMPUTER.
184if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
185    set(hObject,'BackgroundColor','white');
186end
187global warplab_mimo_2x2_GUI;
188warplab_mimo_2x2_GUIdefines;
189evalin('base','t = 0:25e-9:(2^14-1)*25e-9;');
190%define time variable
191warplab_mimo_2x2_GUI.radio3TxData = evalin('base',get(hObject,'String'));
192%define radio3TxData as string of vector
193
194% --- Executes on button press in gobutton.
195function gobutton_Callback(hObject, eventdata, handles)
196% hObject    handle to gobutton (see GCBO)
197% eventdata  reserved - to be defined in a future version of MATLAB
198% handles    structure with handles and user data (see GUIDATA)
199global warplab_mimo_2x2_GUI;
200
201set(hObject, 'Enable', 'Off');
202% warplab_mimo_2x2_GUIdefines;
203
204warplab_mimo_2x2_GUIinitialize;
205% initialize GUI
206set(handles.text31, 'String', '1');
207%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
208% Start of Code to avoid conflict between users, only needed for the
209% workshop
210%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
211% if(okToUseBoards == 0)
212%   set(hObject, 'Enable', 'On');
213% %    set(handles.text_status, 'String', 'Done!');
214%   return;
215% end
216%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
217% End of Code to avoid conflict between users, only needed for the
218% workshop
219%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
220 
221updateOptions(hObject, eventdata, handles)
222
223%Download the samples to be transmitted
224warplab_writeSMWO(warplab_mimo_2x2_GUI.udp_node1, warplab_mimo_2x2_GUI.RADIO2_TXDATA, warplab_mimo_2x2_GUI.radio2TxData);
225warplab_writeSMWO(warplab_mimo_2x2_GUI.udp_node1, warplab_mimo_2x2_GUI.RADIO3_TXDATA, warplab_mimo_2x2_GUI.radio3TxData);
226
227%Enable Tx Radio #2
228if warplab_mimo_2x2_GUI.TxSelect == 0;
229    warplab_sendCmd(warplab_mimo_2x2_GUI.udp_node1, warplab_mimo_2x2_GUI.RADIO2_TXEN, warplab_mimo_2x2_GUI.pktNoTx);
230    warplab_sendCmd(warplab_mimo_2x2_GUI.udp_node1, warplab_mimo_2x2_GUI.RADIO3_TXDIS, warplab_mimo_2x2_GUI.pktNoTx);
231    warplab_sendCmd(warplab_mimo_2x2_GUI.udp_node1, warplab_mimo_2x2_GUI.RADIO2TXBUFF_TXEN, warplab_mimo_2x2_GUI.pktNoTx);
232elseif warplab_mimo_2x2_GUI.TxSelect == 1;
233    warplab_sendCmd(warplab_mimo_2x2_GUI.udp_node1, warplab_mimo_2x2_GUI.RADIO2_TXDIS, warplab_mimo_2x2_GUI.pktNoTx);
234    warplab_sendCmd(warplab_mimo_2x2_GUI.udp_node1, warplab_mimo_2x2_GUI.RADIO3_TXEN, warplab_mimo_2x2_GUI.pktNoTx);
235    warplab_sendCmd(warplab_mimo_2x2_GUI.udp_node1, warplab_mimo_2x2_GUI.RADIO3TXBUFF_TXEN, warplab_mimo_2x2_GUI.pktNoTx);
236elseif warplab_mimo_2x2_GUI.TxSelect == 2;
237    warplab_sendCmd(warplab_mimo_2x2_GUI.udp_node1, warplab_mimo_2x2_GUI.RADIO2_TXEN, warplab_mimo_2x2_GUI.pktNoTx);
238    warplab_sendCmd(warplab_mimo_2x2_GUI.udp_node1, warplab_mimo_2x2_GUI.RADIO3_TXEN, warplab_mimo_2x2_GUI.pktNoTx);
239    warplab_sendCmd(warplab_mimo_2x2_GUI.udp_node1, [warplab_mimo_2x2_GUI.RADIO2TXBUFF_TXEN, warplab_mimo_2x2_GUI.RADIO3TXBUFF_TXEN], warplab_mimo_2x2_GUI.pktNoTx);
240end
241
242set(handles.text31, 'String', '2');
243%Enable Rx Radio #2
244if warplab_mimo_2x2_GUI.RxSelect == 0;
245    warplab_sendCmd(warplab_mimo_2x2_GUI.udp_node2, warplab_mimo_2x2_GUI.RADIO2_RXEN, warplab_mimo_2x2_GUI.pktNoTx);
246    warplab_sendCmd(warplab_mimo_2x2_GUI.udp_node2, warplab_mimo_2x2_GUI.RADIO3_RXDIS, warplab_mimo_2x2_GUI.pktNoTx);
247    warplab_sendCmd(warplab_mimo_2x2_GUI.udp_node2, warplab_mimo_2x2_GUI.RADIO2RXBUFF_RXEN, warplab_mimo_2x2_GUI.pktNoTx);
248elseif warplab_mimo_2x2_GUI.RxSelect == 1;
249    warplab_sendCmd(warplab_mimo_2x2_GUI.udp_node2, warplab_mimo_2x2_GUI.RADIO2_RXDIS, warplab_mimo_2x2_GUI.pktNoTx);
250    warplab_sendCmd(warplab_mimo_2x2_GUI.udp_node2, warplab_mimo_2x2_GUI.RADIO3_RXEN, warplab_mimo_2x2_GUI.pktNoTx);
251    warplab_sendCmd(warplab_mimo_2x2_GUI.udp_node2, warplab_mimo_2x2_GUI.RADIO3RXBUFF_RXEN, warplab_mimo_2x2_GUI.pktNoTx);
252elseif warplab_mimo_2x2_GUI.RxSelect == 2;
253    warplab_sendCmd(warplab_mimo_2x2_GUI.udp_node2, warplab_mimo_2x2_GUI.RADIO2_RXEN, warplab_mimo_2x2_GUI.pktNoTx);
254    warplab_sendCmd(warplab_mimo_2x2_GUI.udp_node2, warplab_mimo_2x2_GUI.RADIO3_RXEN, warplab_mimo_2x2_GUI.pktNoTx);
255    warplab_sendCmd(warplab_mimo_2x2_GUI.udp_node2, [warplab_mimo_2x2_GUI.RADIO2RXBUFF_RXEN, warplab_mimo_2x2_GUI.RADIO3RXBUFF_RXEN], warplab_mimo_2x2_GUI.pktNoTx);
256end
257
258set(handles.text31, 'String', '3');
259%Enable the transmission
260warplab_sendCmd(warplab_mimo_2x2_GUI.udp_node1, warplab_mimo_2x2_GUI.TX_START, warplab_mimo_2x2_GUI.pktNoTx);
261
262%Enable the capture
263warplab_sendCmd(warplab_mimo_2x2_GUI.udp_node2, warplab_mimo_2x2_GUI.RX_START, warplab_mimo_2x2_GUI.pktNoTx);
264
265%Send the SYNC packet
266warplab_sendSync(warplab_mimo_2x2_GUI.udp_Sync);
267
268%Read back the received samples
269global rxData_A rxData_B rxOTR_A rxOTR_B %rxRSSI_A rxRSSI_B;
270rxData_A = zeros(1,2^14);
271rxData_B = zeros(1,2^14);
272rxOTR_A = zeros(1,2^14);
273rxOTR_B = zeros(1,2^14);
274
275set(handles.text31, 'String', '4');
276%Read back the received samples
277if warplab_mimo_2x2_GUI.RxSelect == 0;
278    [RawRxData_A] = warplab_readSMRO(warplab_mimo_2x2_GUI.udp_node2, warplab_mimo_2x2_GUI.RADIO2_RXDATA, 2^14);
279    [rxData_A,rxOTR_A] = warplab_processRawRxData(RawRxData_A);
280elseif warplab_mimo_2x2_GUI.RxSelect == 1;
281    [RawRxData_B] = warplab_readSMRO(warplab_mimo_2x2_GUI.udp_node2, warplab_mimo_2x2_GUI.RADIO3_RXDATA, 2^14);
282    [rxData_B,rxOTR_B] = warplab_processRawRxData(RawRxData_B);
283elseif warplab_mimo_2x2_GUI.RxSelect == 2;
284    [RawRxData_A] = warplab_readSMRO(warplab_mimo_2x2_GUI.udp_node2, warplab_mimo_2x2_GUI.RADIO2_RXDATA, 2^14);
285    [RawRxData_B] = warplab_readSMRO(warplab_mimo_2x2_GUI.udp_node2, warplab_mimo_2x2_GUI.RADIO3_RXDATA, 2^14);
286    [rxData_A,rxOTR_A] = warplab_processRawRxData(RawRxData_A);
287    [rxData_B,rxOTR_B] = warplab_processRawRxData(RawRxData_B);
288end
289
290% Process the received samples to obtain meaningful data
291%[rxData_A,rxOTR_A] = warplab_processRawRxData(RawRxData_A);
292%[rxData_B,rxOTR_B] = warplab_processRawRxData(RawRxData_B);
293
294% Read stored RSSI data
295%[RawRSSIData_A] = warplab_readSMRO(warplab_mimo_2x2_GUI.node_2, warplab_mimo_2x2_GUI.RADIO2_RSSIDATA, warplab_mimo_2x2_GUI.TxLength/8);
296%[RawRSSIData_B] = warplab_readSMRO(warplab_mimo_2x2_GUI.node_2, warplab_mimo_2x2_GUI.RADIO3_RSSIDATA, warplab_mimo_2x2_GUI.TxLength/8);
297
298% Procecss Raw RSSI data to obtain meningful RSSI values
299%[rxRSSI_A] = warplab_processRawRSSIData(RawRSSIData_A);
300%[rxRSSI_B] = warplab_processRawRSSIData(RawRSSIData_B);
301
302set(handles.text31, 'String', '5');
303%[rxData rxOTR rxRSSI] = warplab_RxDataRead(warplab_mimo_2x2_GUI.node_2, 2, warplab_mimo_2x2_GUI.TxLength);
304evalin('base', 'global rxData_A rxData_B rxOTR_A rxOTR_B');
305
306if warplab_mimo_2x2_GUI.TxSelect == 0;
307   warplab_sendCmd(warplab_mimo_2x2_GUI.udp_node1, warplab_mimo_2x2_GUI.RADIO2TXBUFF_TXDIS, warplab_mimo_2x2_GUI.pktNoTx);
308elseif warplab_mimo_2x2_GUI.TxSelect == 1;
309    warplab_sendCmd(warplab_mimo_2x2_GUI.udp_node1, warplab_mimo_2x2_GUI.RADIO3TXBUFF_TXDIS, warplab_mimo_2x2_GUI.pktNoTx);
310elseif warplab_mimo_2x2_GUI.TxSelect == 2;
311    warplab_sendCmd(warplab_mimo_2x2_GUI.udp_node1, [warplab_mimo_2x2_GUI.RADIO2TXBUFF_TXDIS, warplab_mimo_2x2_GUI.RADIO3TXBUFF_TXDIS], warplab_mimo_2x2_GUI.pktNoTx);
312end
313
314if warplab_mimo_2x2_GUI.RxSelect == 0;
315    warplab_sendCmd(warplab_mimo_2x2_GUI.udp_node2, warplab_mimo_2x2_GUI.RADIO2RXBUFF_RXDIS, warplab_mimo_2x2_GUI.pktNoTx);
316elseif warplab_mimo_2x2_GUI.RxSelect == 1;
317    warplab_sendCmd(warplab_mimo_2x2_GUI.udp_node2, warplab_mimo_2x2_GUI.RADIO3RXBUFF_RXDIS, warplab_mimo_2x2_GUI.pktNoTx);
318elseif warplab_mimo_2x2_GUI.RxSelect == 2;
319    warplab_sendCmd(warplab_mimo_2x2_GUI.udp_node2, [warplab_mimo_2x2_GUI.RADIO2RXBUFF_RXDIS, warplab_mimo_2x2_GUI.RADIO3RXBUFF_RXDIS], warplab_mimo_2x2_GUI.pktNoTx);
320end
321
322set(handles.text31, 'String', '6');
323
324%Disable the transmitter
325warplab_sendCmd(warplab_mimo_2x2_GUI.udp_node1, warplab_mimo_2x2_GUI.RADIO2_TXDIS, warplab_mimo_2x2_GUI.pktNoTx);
326warplab_sendCmd(warplab_mimo_2x2_GUI.udp_node1, warplab_mimo_2x2_GUI.RADIO3_TXDIS, warplab_mimo_2x2_GUI.pktNoTx);
327
328%Reset the receivers
329warplab_sendCmd(warplab_mimo_2x2_GUI.udp_node2, warplab_mimo_2x2_GUI.RX_DONEREADING, warplab_mimo_2x2_GUI.pktNoTx);
330
331%Disable the receiver
332warplab_sendCmd(warplab_mimo_2x2_GUI.udp_node2, warplab_mimo_2x2_GUI.RADIO2_RXDIS, warplab_mimo_2x2_GUI.pktNoTx);
333warplab_sendCmd(warplab_mimo_2x2_GUI.udp_node2, warplab_mimo_2x2_GUI.RADIO3_RXDIS, warplab_mimo_2x2_GUI.pktNoTx);
334
335 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
336% Start of Code to avoid conflict between users, only needed for the 
337% workshop
338%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
339pnet('closeall');
340% !del c:\boards_lock.txt
341%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
342% End of Code to avoid conflict between users, only needed for the 
343% workshop
344%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
345
346
347set(handles.text31, 'String', '7');
348axes(handles.axes_RAI); cla; c = axis(gca);
349plot(real(rxData_A));
350axis(gca, c); grid on;
351xlabel('RxA I');
352%plot real data on certain graph
353
354axes(handles.axes_RAQ); cla; f1 = axis(gca);
355plot(imag(rxData_A));
356axis(gca, f1); grid on;
357xlabel('RxA Q');
358%plot imaginary data on certain graph
359
360freq_axis = 40e6*(0:2^14)/2^14;
361freq_axis_shift = fftshift(freq_axis);
362freq_ticks=[freq_axis_shift(1:2^13)-freq_axis_shift(2^13),freq_axis_shift(2^13+1:2^14+1)];
363
364axes(handles.axes_RASpectrum); cla; f2 = axis(gca);
365spectrum=10*log10(abs(fftshift(fft(rxData_A))));
366plot(freq_ticks(2^12:3*2^12),spectrum(2^12:3*2^12));
367% spectrum=10*log10(abs(fftshift(fft(warplab_sisoGUI.radio2TxData))))
368% plot(freq_ticks,10*log10(abs(fftshift(fft(warplab_sisoGUI.radio2TxData)))));
369%plot(10*log10(abs(fft(warplab_sisoGUI.radio2TxData,2^14))));
370%axis tight;
371grid on;
372xlabel('RxA Spectrum');
373
374axes(handles.axes_RBI); cla; f3 = axis(gca);
375plot(real(rxData_B));
376axis(gca, f3); grid on;
377xlabel('RxB I');
378%plot real data on certain graph
379
380axes(handles.axes_RBQ); cla; f4 = axis(gca);
381plot(imag(rxData_B));
382axis(gca, f4); grid on;
383xlabel('RxB Q');
384%plot imaginary data on certain graph
385
386axes(handles.axes_RBSpectrum); cla; f5 = axis(gca);
387spectrum=10*log10(abs(fftshift(fft(rxData_B))));
388plot(freq_ticks(2^12:3*2^12),spectrum(2^12:3*2^12));
389%plot(10*log10(abs(fftshift(fft(rxData)))));
390%plot(10*log10(abs(fft(rxData,2^14))));
391%axis tight;
392grid on;
393xlabel('RxB Spectrum');
394set(hObject, 'Enable', 'On');
395
396set(handles.text31, 'String', '8');
397% --- Executes during object deletion, before destroying properties.
398function figure1_DeleteFcn(hObject, eventdata, handles)
399% hObject    handle to figure1 (see GCBO)
400% eventdata  reserved - to be defined in a future version of MATLAB
401% handles    structure with handles and user data (see GUIDATA)
402pnet('closeall');
403
404
405function TxA_BB_Callback(hObject, eventdata, handles)
406% hObject    handle to TxA_BB (see GCBO)
407% eventdata  reserved - to be defined in a future version of MATLAB
408% handles    structure with handles and user data (see GUIDATA)
409
410% Hints: get(hObject,'String') returns contents of TxA_BB as text
411%        str2double(get(hObject,'String')) returns contents of TxA_BB as a double
412
413
414% --- Executes during object creation, after setting all properties.
415function TxA_BB_CreateFcn(hObject, eventdata, handles)
416% hObject    handle to TxA_BB (see GCBO)
417% eventdata  reserved - to be defined in a future version of MATLAB
418% handles    empty - handles not created until after all CreateFcns called
419
420% Hint: edit controls usually have a white background on Windows.
421%       See ISPC and COMPUTER.
422if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
423    set(hObject,'BackgroundColor','white');
424end
425global warplab_mimo_2x2_GUI;
426set(hObject, 'String', sprintf('%d', warplab_mimo_2x2_GUI.TxA_BB));
427% set value of TxA_BB (choosen by user) as gain
428
429function TxB_BB_Callback(hObject, eventdata, handles)
430% hObject    handle to TxB_BB (see GCBO)
431% eventdata  reserved - to be defined in a future version of MATLAB
432% handles    structure with handles and user data (see GUIDATA)
433
434% Hints: get(hObject,'String') returns contents of TxB_BB as text
435%        str2double(get(hObject,'String')) returns contents of TxB_BB as a double
436
437
438% --- Executes during object creation, after setting all properties.
439function TxB_BB_CreateFcn(hObject, eventdata, handles)
440% hObject    handle to TxB_BB (see GCBO)
441% eventdata  reserved - to be defined in a future version of MATLAB
442% handles    empty - handles not created until after all CreateFcns called
443
444% Hint: edit controls usually have a white background on Windows.
445%       See ISPC and COMPUTER.
446if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
447    set(hObject,'BackgroundColor','white');
448end
449global warplab_mimo_2x2_GUI;
450set(hObject, 'String', sprintf('%d', warplab_mimo_2x2_GUI.TxB_BB));
451% set value of TxB_BB (choosen by user) as gain
452
453function TxA_RF_Callback(hObject, eventdata, handles)
454% hObject    handle to TxA_RF (see GCBO)
455% eventdata  reserved - to be defined in a future version of MATLAB
456% handles    structure with handles and user data (see GUIDATA)
457
458% Hints: get(hObject,'String') returns contents of TxA_RF as text
459%        str2double(get(hObject,'String')) returns contents of TxA_RF as a double
460
461
462% --- Executes during object creation, after setting all properties.
463function TxA_RF_CreateFcn(hObject, eventdata, handles)
464% hObject    handle to TxA_RF (see GCBO)
465% eventdata  reserved - to be defined in a future version of MATLAB
466% handles    empty - handles not created until after all CreateFcns called
467
468% Hint: edit controls usually have a white background on Windows.
469%       See ISPC and COMPUTER.
470if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
471    set(hObject,'BackgroundColor','white');
472end
473global warplab_mimo_2x2_GUI;
474set(hObject, 'String', sprintf('%d', warplab_mimo_2x2_GUI.TxA_RF));
475% set value of TxA_RF (choosen by user) as gain
476
477function TxB_RF_Callback(hObject, eventdata, handles)
478% hObject    handle to TxB_RF (see GCBO)
479% eventdata  reserved - to be defined in a future version of MATLAB
480% handles    structure with handles and user data (see GUIDATA)
481
482% Hints: get(hObject,'String') returns contents of TxB_RF as text
483%        str2double(get(hObject,'String')) returns contents of TxB_RF as a double
484
485
486% --- Executes during object creation, after setting all properties.
487function TxB_RF_CreateFcn(hObject, eventdata, handles)
488% hObject    handle to TxB_RF (see GCBO)
489% eventdata  reserved - to be defined in a future version of MATLAB
490% handles    empty - handles not created until after all CreateFcns called
491
492% Hint: edit controls usually have a white background on Windows.
493%       See ISPC and COMPUTER.
494if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
495    set(hObject,'BackgroundColor','white');
496end
497global warplab_mimo_2x2_GUI;
498set(hObject, 'String', sprintf('%d', warplab_mimo_2x2_GUI.TxB_RF));
499% set value of TxB_RF (choosen by user) as gain
500
501function RxA_BB_Callback(hObject, eventdata, handles)
502% hObject    handle to RxA_BB (see GCBO)
503% eventdata  reserved - to be defined in a future version of MATLAB
504% handles    structure with handles and user data (see GUIDATA)
505
506% Hints: get(hObject,'String') returns contents of RxA_BB as text
507%        str2double(get(hObject,'String')) returns contents of RxA_BB as a double
508
509
510% --- Executes during object creation, after setting all properties.
511function RxA_BB_CreateFcn(hObject, eventdata, handles)
512% hObject    handle to RxA_BB (see GCBO)
513% eventdata  reserved - to be defined in a future version of MATLAB
514% handles    empty - handles not created until after all CreateFcns called
515
516% Hint: edit controls usually have a white background on Windows.
517%       See ISPC and COMPUTER.
518if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
519    set(hObject,'BackgroundColor','white');
520end
521global warplab_mimo_2x2_GUI;
522set(hObject, 'String', sprintf('%d', warplab_mimo_2x2_GUI.RxA_BB));
523% set value of RxA_BB (choosen by user) as gain
524
525function RxA_RF_Callback(hObject, eventdata, handles)
526% hObject    handle to RxA_RF (see GCBO)
527% eventdata  reserved - to be defined in a future version of MATLAB
528% handles    structure with handles and user data (see GUIDATA)
529
530% Hints: get(hObject,'String') returns contents of RxA_RF as text
531%        str2double(get(hObject,'String')) returns contents of RxA_RF as a double
532
533
534% --- Executes during object creation, after setting all properties.
535function RxA_RF_CreateFcn(hObject, eventdata, handles)
536% hObject    handle to RxA_RF (see GCBO)
537% eventdata  reserved - to be defined in a future version of MATLAB
538% handles    empty - handles not created until after all CreateFcns called
539
540% Hint: edit controls usually have a white background on Windows.
541%       See ISPC and COMPUTER.
542if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
543    set(hObject,'BackgroundColor','white');
544end
545global warplab_mimo_2x2_GUI;
546set(hObject, 'String', sprintf('%d', warplab_mimo_2x2_GUI.RxA_RF));
547% set value of RxA_RF(choosen by user) as gain
548
549function RxB_RF_Callback(hObject, eventdata, handles)
550% hObject    handle to RxB_RF (see GCBO)
551% eventdata  reserved - to be defined in a future version of MATLAB
552% handles    structure with handles and user data (see GUIDATA)
553
554% Hints: get(hObject,'String') returns contents of RxB_RF as text
555%        str2double(get(hObject,'String')) returns contents of RxB_RF as a double
556
557
558% --- Executes during object creation, after setting all properties.
559function RxB_RF_CreateFcn(hObject, eventdata, handles)
560% hObject    handle to RxB_RF (see GCBO)
561% eventdata  reserved - to be defined in a future version of MATLAB
562% handles    empty - handles not created until after all CreateFcns called
563
564% Hint: edit controls usually have a white background on Windows.
565%       See ISPC and COMPUTER.
566if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
567    set(hObject,'BackgroundColor','white');
568end
569global warplab_mimo_2x2_GUI;
570set(hObject, 'String', sprintf('%d', warplab_mimo_2x2_GUI.RxB_RF));
571% set value of RxB_RF (choosen by user) as gain
572
573function RxB_BB_Callback(hObject, eventdata, handles)
574% hObject    handle to RxB_BB (see GCBO)
575% eventdata  reserved - to be defined in a future version of MATLAB
576% handles    structure with handles and user data (see GUIDATA)
577
578% Hints: get(hObject,'String') returns contents of RxB_BB as text
579%        str2double(get(hObject,'String')) returns contents of RxB_BB as a double
580
581
582% --- Executes during object creation, after setting all properties.
583function RxB_BB_CreateFcn(hObject, eventdata, handles)
584% hObject    handle to RxB_BB (see GCBO)
585% eventdata  reserved - to be defined in a future version of MATLAB
586% handles    empty - handles not created until after all CreateFcns called
587
588% Hint: edit controls usually have a white background on Windows.
589%       See ISPC and COMPUTER.
590if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
591    set(hObject,'BackgroundColor','white');
592end
593global warplab_mimo_2x2_GUI;
594set(hObject, 'String', sprintf('%d', warplab_mimo_2x2_GUI.RxB_BB));
595% set value of RxB_BB (choosen by user) as gain
596
597function Channel_Callback(hObject, eventdata, handles)
598% hObject    handle to Channel (see GCBO)
599% eventdata  reserved - to be defined in a future version of MATLAB
600% handles    structure with handles and user data (see GUIDATA)
601
602% Hints: get(hObject,'String') returns contents of Channel as text
603%        str2double(get(hObject,'String')) returns contents of Channel as a double
604
605
606% --- Executes during object creation, after setting all properties.
607function Channel_CreateFcn(hObject, eventdata, handles)
608% hObject    handle to Channel (see GCBO)
609% eventdata  reserved - to be defined in a future version of MATLAB
610% handles    empty - handles not created until after all CreateFcns called
611
612% Hint: edit controls usually have a white background on Windows.
613%       See ISPC and COMPUTER.
614if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
615    set(hObject,'BackgroundColor','white');
616end
617
618
619function Capture_Offset_Callback(hObject, eventdata, handles)
620% hObject    handle to Capture_Offset (see GCBO)
621% eventdata  reserved - to be defined in a future version of MATLAB
622% handles    structure with handles and user data (see GUIDATA)
623
624% Hints: get(hObject,'String') returns contents of Capture_Offset as text
625%        str2double(get(hObject,'String')) returns contents of Capture_Offset as a double
626
627
628% --- Executes during object creation, after setting all properties.
629function Capture_Offset_CreateFcn(hObject, eventdata, handles)
630% hObject    handle to Capture_Offset (see GCBO)
631% eventdata  reserved - to be defined in a future version of MATLAB
632% handles    empty - handles not created until after all CreateFcns called
633
634% Hint: edit controls usually have a white background on Windows.
635%       See ISPC and COMPUTER.
636if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
637    set(hObject,'BackgroundColor','white');
638end
639% --------------------------------------------------------------------
640function uipanel6_SelectionChangeFcn(hObject, eventdata, handles)
641% hObject    handle to uipanel6 (see GCBO)
642% eventdata  reserved - to be defined in a future version of MATLAB
643% handles    structure with handles and user data (see GUIDATA)
644switch get(hObject,'Tag')
645    case 'TxradioA'
646        set(handles.TxSelect1, 'String' ,'0')
647    case 'TxradioB'
648        set(handles.TxSelect1, 'String' ,'1')
649    case 'TxradioBoth'
650        set(handles.TxSelect1, 'String' ,'2')
651    otherwise
652        display kobe
653end
654
655% --------------------------------------------------------------------
656function uipanel5_SelectionChangeFcn(hObject, eventdata, handles)
657% hObject    handle to uipanel5 (see GCBO)
658% eventdata  reserved - to be defined in a future version of MATLAB
659% handles    structure with handles and user data (see GUIDATA)
660switch get(hObject,'Tag')
661    case 'RxradioA'
662        set(handles.RxSelect1, 'String' ,'0')
663    case 'RxradioB'
664        set(handles.RxSelect1, 'String' ,'1')
665    case 'RxradioBoth'
666        set(handles.RxSelect1, 'String' ,'2')
667    otherwise
668        display kobe
669end
670
671set(handles.text31, 'String', '10');
672%Define the options vector; the order of opitons is set by the FPGA's code
673function updateOptions(hObject, eventdata, handles)
674global warplab_mimo_2x2_GUI;
675warplab_mimo_2x2_GUIdefines;
676warplab_mimo_2x2_GUI.TxA_BB = eval(get(handles.TxA_BB, 'String'));
677warplab_mimo_2x2_GUI.TxB_BB = eval(get(handles.TxB_BB, 'String'));
678warplab_mimo_2x2_GUI.TxA_RF = eval(get(handles.TxA_RF, 'String'));
679warplab_mimo_2x2_GUI.TxB_RF = eval(get(handles.TxB_RF, 'String'));
680warplab_mimo_2x2_GUI.RxA_BB = eval(get(handles.RxA_BB, 'String'));
681warplab_mimo_2x2_GUI.RxB_BB = eval(get(handles.RxB_BB, 'String'));
682warplab_mimo_2x2_GUI.RxA_RF = eval(get(handles.RxA_RF, 'String'));
683warplab_mimo_2x2_GUI.RxB_RF = eval(get(handles.RxB_RF, 'String'));
684% warplab_mimo_2x2_GUI.CaptOffset = eval(get(handles.Capture_Offset, 'String'));
685warplab_mimo_2x2_GUI.TxDelay = eval(get(handles.Capture_Offset, 'String'));
686warplab_mimo_2x2_GUI.CarrierChannel = eval(get(handles.Channel, 'String'));
687warplab_mimo_2x2_GUI.TxSelect = eval(get(handles.TxSelect1, 'String'));
688warplab_mimo_2x2_GUI.RxSelect = eval(get(handles.RxSelect1, 'String'));
689warplab_mimo_2x2_GUI.TxMode = 0;
690
691% warplab_writeRegister(warplab_mimo_2x2_GUI.udp_node2,warplab_mimo_2x2_GUI.CAPT_OFFSET, warplab_mimo_2x2_GUI.CaptOffset);
692warplab_writeRegister(warplab_mimo_2x2_GUI.udp_node1,warplab_mimo_2x2_GUI.TX_DELAY, warplab_mimo_2x2_GUI.TxDelay);
693warplab_writeRegister(warplab_mimo_2x2_GUI.udp_node1,warplab_mimo_2x2_GUI.TX_LENGTH, warplab_mimo_2x2_GUI.TxLength);
694warplab_writeRegister(warplab_mimo_2x2_GUI.udp_node1,warplab_mimo_2x2_GUI.TX_MODE, warplab_mimo_2x2_GUI.TxMode);
695warplab_setRadioParameter(warplab_mimo_2x2_GUI.udp_node1,warplab_mimo_2x2_GUI.CARRIER_CHANNEL,warplab_mimo_2x2_GUI.CarrierChannel);
696warplab_setRadioParameter(warplab_mimo_2x2_GUI.udp_node2,warplab_mimo_2x2_GUI.CARRIER_CHANNEL,warplab_mimo_2x2_GUI.CarrierChannel);
697warplab_setRadioParameter(warplab_mimo_2x2_GUI.udp_node1,warplab_mimo_2x2_GUI.RADIO2_TXGAINS,(warplab_mimo_2x2_GUI.TxA_RF + warplab_mimo_2x2_GUI.TxA_BB*2^16));
698warplab_setRadioParameter(warplab_mimo_2x2_GUI.udp_node1,warplab_mimo_2x2_GUI.RADIO3_TXGAINS,(warplab_mimo_2x2_GUI.TxB_RF + warplab_mimo_2x2_GUI.TxB_BB*2^16));
699warplab_setRadioParameter(warplab_mimo_2x2_GUI.udp_node2,warplab_mimo_2x2_GUI.RADIO2_RXGAINS,(warplab_mimo_2x2_GUI.RxA_BB + warplab_mimo_2x2_GUI.RxA_RF*2^16));
700warplab_setRadioParameter(warplab_mimo_2x2_GUI.udp_node2,warplab_mimo_2x2_GUI.RADIO3_RXGAINS,(warplab_mimo_2x2_GUI.RxB_BB + warplab_mimo_2x2_GUI.RxB_RF*2^16));
701set(handles.text31, 'String', '11');
702
703
704    % --- Executes during object creation, after setting all properties.
705function axes_RAI_CreateFcn(hObject, eventdata, handles)
706% hObject    handle to axes_RAI (see GCBO)
707% eventdata  reserved - to be defined in a future version of MATLAB
708% handles    empty - handles not created until after all CreateFcns called
709
710% Hint: place code in OpeningFcn to populate axes_RAI
711
712
713axis(gca, [-1 2^14 -1 1]);
714grid on;
715%plot with grid on
716
717% --- Executes during object creation, after setting all properties.
718function axes_RAQ_CreateFcn(hObject, eventdata, handles)
719% hObject    handle to axes_RAQ (see GCBO)
720% eventdata  reserved - to be defined in a future version of MATLAB
721% handles    empty - handles not created until after all CreateFcns called
722
723% Hint: place code in OpeningFcn to populate axes_RAQ
724
725axis(gca, [-1 2^14 -1 1]);
726grid on;
727%plot with grid on
728
729% --- Executes during object creation, after setting all properties.
730function axes_RASpectrum_CreateFcn(hObject, eventdata, handles)
731% hObject    handle to axes_RASpectrum (see GCBO)
732% eventdata  reserved - to be defined in a future version of MATLAB
733% handles    empty - handles not created until after all CreateFcns called
734
735% Hint: place code in OpeningFcn to populate axes_RASpectrum
736
737
738axis(gca, [-1 2^14 -1 1]);
739grid on;
740%plot with grid on
741
742% --- Executes during object creation, after setting all properties.
743function axes_RBI_CreateFcn(hObject, eventdata, handles)
744% hObject    handle to axes_RBI (see GCBO)
745% eventdata  reserved - to be defined in a future version of MATLAB
746% handles    empty - handles not created until after all CreateFcns called
747
748% Hint: place code in OpeningFcn to populate axes_RBI
749
750
751axis(gca, [-1 2^14 -1 1]);
752grid on;
753%plot with grid on
754
755% --- Executes during object creation, after setting all properties.
756function axes_RBQ_CreateFcn(hObject, eventdata, handles)
757% hObject    handle to axes_RBQ (see GCBO)
758% eventdata  reserved - to be defined in a future version of MATLAB
759% handles    empty - handles not created until after all CreateFcns called
760
761% Hint: place code in OpeningFcn to populate axes_RBQ
762
763
764axis(gca, [-1 2^14 -1 1]);
765grid on;
766%plot with grid on
767
768% --- Executes during object creation, after setting all properties.
769function axes_RBSpectrum_CreateFcn(hObject, eventdata, handles)
770% hObject    handle to axes_RBSpectrum (see GCBO)
771% eventdata  reserved - to be defined in a future version of MATLAB
772% handles    empty - handles not created until after all CreateFcns called
773
774% Hint: place code in OpeningFcn to populate axes_RBSpectrum
775
776axis(gca, [-1 2^14 -1 1]);
777grid on;
778%plot with grid on
Note: See TracBrowser for help on using the repository browser.