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

Last change on this file was 1311, checked in by mduarte, 15 years ago

Adding files for WARPLab release 05

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