?? ofdm.m
字號:
function varargout = ofdm(varargin)
% OFDM M-file for ofdm.fig
% OFDM, by itself, creates a new OFDM or raises the existing
% singleton*.
%
% H = OFDM returns the handle to a new OFDM or the handle to
% the existing singleton*.
%
% OFDM('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in OFDM.M with the given input arguments.
%
% OFDM('Property','Value',...) creates a new OFDM or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before ofdm_OpeningFunction gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to ofdm_OpeningFcn via varargin.
%
% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
% instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES
% Copyright 2002-2003 The MathWorks, Inc.
% Edit the above text to modify the response to help ofdm
% Last Modified by GUIDE v2.5 19-May-2005 09:54:09
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @ofdm_OpeningFcn, ...
'gui_OutputFcn', @ofdm_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT
% --- Executes just before ofdm is made visible.
function ofdm_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to ofdm (see VARARGIN)
% Choose default command line output for ofdm
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes ofdm wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = ofdm_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Get default command line output from handles structure
varargout{1} = handles.output;
% --- Executes on button press in pushbutton2.
function pushbutton2_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% set(handles.exit,'UserData',1); % This will halt execution!
slidenum = get(hObject,'UserData');
pointsave=get(gcbf,'Pointer');
set(gcbf,'Pointer','watch');
if slidenum == 1,
setupGUI;
%axisHnd1=findobj('Tag','Axes1');
set(handles.axes1,'Visible','on');
% Stem Plot the Binary Data
stem(data_in,'filled');
msg = { '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. '...
' '...
' '...
' '...
' ';...
};
set(handles.infobox,'String',msg);
guidata(gcbo,handles);
% set(hObject,'String','Load Project');
set(hObject,'UserData',slidenum+1);
elseif slidenum == 2,
%drawnow;
setupGUI;
msg = { '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. ';...
};
set(handles.infobox,'String',msg);
guidata(gcbo,handles);
set(hObject,'UserData',slidenum+1);
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
grid(handles.axes1);
stem(data_in,'filled'),hold off
elseif slidenum == 3,
setupGUI
% Perform the ifft and display the results
msg = { '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. '...
' '...
' '...
' '...
' ';...
};
set(handles.infobox,'String',msg);
guidata(gcbo,handles);
set(hObject,'UserData',slidenum+1);
tx
plot(xmit)
elseif slidenum == 4,
msg = { '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. '...
' '...
' ';...
};
set(handles.infobox,'String',msg);
set(hObject,'UserData',slidenum+1);
elseif slidenum == 5,
setupGUI
msg = { '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. '...
' '...
' ';...
};
set(handles.infobox,'String',msg);
tx, ch, rx
stem(output,'filled')
%nextHnd1=findobj('Tag','PushbuttonNext');
set(hObject,'String','Start Over') % repeat if desired
% otherwise
% disp('error')
% guidata(gcbo,handles);
% set(hObject,'UserData',slidenum+1);
%
end
set(gcbf,'Pointer',pointsave);
% --- Executes on button press in pushbutton3.
function pushbutton3_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
delete(gcbf);
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -