?? commsmtr.m
字號:
function commsmtr(varargin)
% COMMSMTR - simulator console application for a certain communications system
% Please compile it into windows console application commsmtr.exe
% as the following MATLAB commands:
% >>mex -setup
% >>mbuild -setup
% >>mcc -B sgl commsmtr.m
% then run it as a executable program in Windows console, just like
% >commsmtr /?
% >commsmtr sui416qam.mat /s 5 /r 0:5:40 /c 4 /m 1 /f 256 /t 10000 /p 0.25
% and so on.
%
% Note!!!
% This example is just for explaining how to input multiple command line parameters
% not for simulation.
%
% author: YongchunChen
% date: 2002/02/08
% version: 1.0
%% defining default system parameters
commSys.Fs=5000000; % sampling frquency=5MHz
commSys.Eb_N0=0:5:40; % the ratio of Energy of each bit to noise power spectral density
commSys.channelType=4; % SUI-channel type
commSys.channelMode=strvcat('AWGN',... % channel type
'SUI-1 + AWGN',...
'SUI-2 + AWGN',...
'SUI-3 + AWGN',...
'SUI-4 + AWGN',...
'SUI-5 + AWGN',...
'SUI-6 + AWGN',...
'Jakes + AWGN');
commSys.ifftSize=256; % IFFT size
commSys.wordSize=1; % word size corresponding to modulation method
% 1 BPSK <==>2QAM
% 2 QPSK <==>4QAM
% 4 16QAM
% 6 64QAM
commSys.energyNormalized=[1,1/sqrt(2),1,1/sqrt(10),1,1/sqrt(42)];
commSys.mappingMode=strvcat('BPSK',... % mapping type
'QPSK ',...
' ',...
'16QAM',...
' ',...
'64QAM');
% total transmitted data bits including data used to estimate channel
commSys.totalBits=commSys.ifftSize*commSys.wordSize*256;
commSys.cpLenRatio=1/4; % cyclic prefix length in unit:(ifftSize)
% length of CP equal to 1/4 of IFFT size
commSys.cpLen=round(commSys.ifftSize*commSys.cpLenRatio);
commSys.dataFileName='commsimulation.mat';
commSys.thirdDemension=0; % nothing as the third demension
% preamble symbol column used to estimate channel, here we assume it as 1
commSys.estimatingColumn=1;
%% end of definding default system parameters
% processing command line parameters
paramLen=length(varargin);
% display helping text for the simulator console application
if paramLen==1&strmatch('/?',varargin)
disphelp;
return;
end
if paramLen~=0
[cmdLineErr,commSys]=prcsOfCmdLine(commSys,varargin,paramLen);
if cmdLineErr
return;
end
end
% display system parameters
disp('**********system parameter for current simulation**********');
disp(['the sampling frequency: Fs=',num2str(commSys.Fs/1000000),' (MHz)']);
disp(['the ratio of energy of each bit to noise power spectral density: Eb/N0=', ...
num2str(commSys.Eb_N0)]);
disp('the channel mode:');
disp(cat(2,zeros(length(commSys.channelType),17),commSys.channelMode( ...
commSys.channelType+1,:)));
disp('the mapping method:');
disp(cat(2,zeros(length(commSys.wordSize),17),commSys.mappingMode( ...
commSys.wordSize,:)));
disp(['the size of IFFT: ',num2str(commSys.ifftSize)]);
disp(['the total bits of transmitted data: ',num2str(commSys.totalBits)]);
disp(['the size of cyclic prefix: ',num2str(commSys.cpLen)]);
disp(['the simulation results will be saved in file ',commSys.dataFileName]);
disp(' ');
% the processing is omitted
% ......
%
%%% end of simulator console application
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -