?? mimo.m
字號:
%MIMO Run MIMO system simulation.% MIMO is the main simulation script where all the blocks are glued% together. Refer to the PDF documentation. This is the body of the% program which allows you to set various simulation conditions and% change wide range of parameters. Modular architecture let's you% easy focus your effort on the particular block development while% the rest of the system is not affected by this module. Other modules% can be integrated into the body very easily. You just modify the% simulation parameters in the script header. %% MIMO script is also suited for a code performance measurement. In % such a case you should disable function ECHOes and enable PROG_INFO% instead. This keeps you informed about the simulation run, which% usually takes a long time. You may also do some post-processing by% calling a POST function or archive the simulation report into a% log-file.%% See also POST, LOGREPORT, MESG and the script body to learn more.% Copyright 2001-2003 Kamil Anis, anisk@feld.cvut.cz% Dept. of Radioelectronics, % Faculty of Electrical Engineering% Czech Technical University in Prague% $Revision: 2.2 $ $Date: 2003/5/23 22:01:58 $% --% <additional stuff goes here>clear all; close all;tic;% system-wide variablesglobal ECHO SYMB_ENERGY SYMB_SAMPLES SYMB_TIME CH_CONF SMPLPER GAIN... SIG_PWR PULSE INDENT TIMING VERSIONVERSION = '2.2.0'; % toolkit versionECHO = 'on'; % enable function echoes% ECHO = 'off'; % disable functions echoes% prog_info = 1; % enable progress infoprog_info = 0; % disable progress info% INDENT = 12; % set function indentingfashion; % graphics settingsmd = 4; % # of constellation signalss = 8; % # of code trellis statesfr_length = 10; % frame length [symbols]frames = 20; % # of frameszf = 3; % length of zero appendixsrc_mode = 'rand'; % source operation mode% src_mode = 'ramp';% src_mode = 'const';src_const = 1;enc_scheme = 'att'; % encoding schemepulse_shape = 'rrc'; % modulation impulse shape% pulse_shape = 'rect';pulse_cutoff = 8; % mod. impulse shorteningpulse_rolloff = 0.4; % roll-off factorSYMB_TIME = 0.0001; % symbol durationSYMB_SAMPLES = 4; % samples per symbolSYMB_ENERGY = 1; % symbol average energyCH_CONF = [2 2]; % MIMO configurationch_snr_pts = 10; % # of points to be measuredch_snr_lo = 1;ch_snr_hi = 10;ch_snr = 4; % channel SNR [dB]% ch_snr = linspace(ch_snr_lo,...% ch_snr_hi,ch_snr_pts);% ch_fading = 'none'; % MIMO channel fading% ch_fading = 'awgn';ch_fading = 'rayleigh';est_csi = 'perfect'; % CSI mode%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% INIT %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% pre-requisitiesSMPLPER = SYMB_TIME / SYMB_SAMPLES; % symbol sample periodSIG_PWR = SYMB_ENERGY / SYMB_TIME; % modulation (constell) powerGAIN = rescale(md,SYMB_ENERGY); % scale factorTIMING = 0; % disable DETECT timing when running performance measurementtiming = 0;name = 'MIMO';[idt,tag] = iecho(name);[dlt,slt] = ltable(md,s,'Method',enc_scheme);PULSE = makepulse('Shape',pulse_shape,'Shortening',pulse_cutoff,... 'RollOff',pulse_rolloff);%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% RUN %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%if prog_info clc; disp(' '); disp([tag,'Running MIMO system performance measurement. Please wait...']); disp(' ');endfor i = 1:length(ch_snr) % running modules data_src = source(fr_length,frames,md,zf,'Pattern',src_mode); data_enc = space(data_src,dlt,slt); sig_mod = modul(data_enc,md); [sig_corr,ch_coefs] = channel(sig_mod,'Fading',ch_fading,'SNR',ch_snr(i)); % [est_coefs,mse]=est(sig_corr,est_csi,ch_coefs); % this block has been temporarily removed. sig_mf = mfilter(sig_corr); [data_est,state_est] = detect(sig_mf,dlt,slt,ch_coefs); % counting the errors [err_i,ser_i] = count(data_src,data_est); ser(i) = ser_i; err(i) = err_i; if prog_info mesg; endend%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% VISUAL LAYER & POST-PROCESSING %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% check pulse shape% stem(PULSE);% display designfigure(1); dispdes(dlt,slt); % display decoding process in a graphical formfigure (2); disptrell(dlt,slt,data_est,state_est);% display code performanceif length(ch_snr) > 1 figure(3); post(ch_snr,ser); end% save simulation report into a filelogreport;
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -