OFDMguiFn.m
上传用户:m_sun_001
上传日期:2014-07-30
资源大小:1115k
文件大小:4k
- function OFDMguiFn(action)
% Consolidates all of the GUI callbacks into one main function
stringArray = [...
% Slide 1
'Welcome to the basic OFDM (Orthogonal Frequency '...
'Division Multiplexing) demo. Please click the Next '...
'button to get started. '...
' '...
' '...
' '...
' ';...
% Slide 2
'Assume that we want to transmit the following binary '...
'data using OFDM: [0 0 0 1 1 0 1 1]. '...
'The plot shows this binary data. '...
' '...
' '...
' '...
' ';...
% Slide 3
'In OFDM an IFFT (Inverse Fast Fourier Transform) is '...
'used to put the binary numbers onto many frequencies. '...
'Due to the math involved in an IFFT, these '...
'frequencies do not interfere with eath other (in '...
'communication terms, this is called "Orthogonality"). '...
'The plot shows that each group of 2 blue data points '...
'under a red hump will be put onto one frequency. ';...
% Slide 4
'The IFFT math is now complete. It has generated an '...
'OFDM signal that corresponds to the binary data. '...
'The plot shows the signal generated by the IFFT. '...
' '...
' '...
' '...
' ';...
% Slide 5 - same plot
'Now, this OFDM signal can be transmitted through a '...
'media and then received. This media (or "Channel" in '...
'communication) could be wired or wireless. Once the '...
'signal is received, the reverse process is done to '...
'recover the original binary data. '...
' '...
' ';...
% Slide 6
'Finally, an FFT (Fast Fourier Transform) is used to '...
'recover the binary data as shown in the plot. Note '...
'that the FFT is the opposite of the IFFT used to '...
'generate the OFDM signal. As long as the Channel does '...
'not distort the OFDM signal too much, the original '...
'binary data can be recovered. '...
' '];
switch(action)
case 'next' %---------------------------------------
textHnd1=findobj('Tag','StaticTextFeedback');
nextHnd1=findobj('Tag','PushbuttonNext'); % handler for the Next button
axisHnd1=findobj('Tag','Axes1');
global COUNTER
if isempty(COUNTER)
COUNTER = 0; % initialize COUNTER if doesn't exist
end
COUNTER = COUNTER + 1;
[r c]=size(stringArray);
if COUNTER > r
COUNTER = 0;
close(gcf)
- % basicGUI
basicGUI_win % for windows version
else
set(textHnd1,'String',stringArray(COUNTER,:))
switch(COUNTER)
case 1
% disp('Slide 1')
case 2
% disp('Slide 2')
setupGUI % sets up the GUI variables
set(axisHnd1,'Visible','on')
% Stem Plot the Binary Data
stem(data_in,'filled')
case 3
% disp('Slide 3')
setupGUI % sets up the GUI variables
% add groupings around the stem plot
y=1.2*abs(sin(linspace(0,4*pi,80))).^(1/5);
x=linspace(0.5,8.5,80);
plot(x,y,'r'),hold on
stem(data_in,'filled'),hold off
case 4
% disp('Slide 4')
setupGUI
% Perform the ifft and display the results
tx
plot(xmit)
case 5
% disp('Slide 5')
% same plot
case 6
% disp('Slide 6')
setupGUI
tx, ch, rx
stem(output,'filled')
set(nextHnd1,'String','Start Over') % repeat if desired
otherwise
disp('error')
end
end
case 'close' %--------------------------------------
clear global COUNTER
close(gcbf)
case 'figure' %--------------------------------------
% this is called whenever the figure is first created -or NOT??
textHnd1=findobj('Tag','StaticTextFeedback');
axisHnd1=findobj('Tag','Axes1');
set(textHnd1,'String','Basic OFDM Demo') % default text messag
set(axisHnd1,'Visible','off') % hide Axis to begin
end