⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 setup.m

📁 关于MIMO-OFDM的matlab和simulink仿真程序或模型(有OFDM的simulink仿真模型
💻 M
字号:
% setup
disp(' '), disp('------------------------------------------------------------')
disp('Simulation Setup')

% OFDM Setup -----------------------------------------------------------
fft_size = 128;		% should be a power of 2 for fast computation
				% more points = more time domain samples (smoother & more cycles)
num_carriers = 32;	% should be <= fft_size/4
				% number of carriers used for each data chunk
% new var - denotes even spacing or variations of carriers among fft points
input_type = 1;
% 1 = test input
	test_input_type = 3;
	% 1 = bit specified (binary)
		binary_data = [0 1 0 1 0 1 0 1 1 1 0 0 1 0 0 1 1 0 1 0 1 0 1];
	% 2 = random data stream (samples in the range of 0-255)
		num_symbols = 9;
	% 3 = sinusoidal
		frequency = 2;
		num_samples = 50;
% 2 = external file input
	file_name = 'shortest.wav';		% Name of input file
	file_input_type = 3;
		% 1 = binary (not implemented)
		% 2 = text					% Demo file:  'text.txt'
		% 3 = sound				% Demo files: 'shortest.wav' & 'shorter.wav'
		% 4 = image (not implemented)


% QAM Setup ------------------------------------------------------------
do_QAM = 1;		% (1=on, 0=off)
QAM_periods = 10;	% defines the number of periods per QAM Symbos (1=2*pi)


% Channel Simulation Parameters --------------------------------------------
channel_on = 1;		% 1=on, 0=off
clip_level = 1.0;		% 0.0 - 1.0 (0-100%)
	% Max magnitude of the signal is 'clip_level' times the full magnitude of the signal
noise_level = 0.0;	% 0.0 - 1.0 (0-100%)
	% Magnitude of noise is 'noise_level' times the magnitude of the signal
% Multipath Channel Simulation
	% Good defaults when fft_size = 128 and num_carriers = 32:
	%	d1=6; a1=0.30; d2=10; a2=0.25
	d1 = 6;		% delay in units
	a1 = 0.30; 	% attenuation factor - multipath signal is x% of size or original signal
	d2 = 10;		% delay for second multipath signal
	a2 = 0.25;	% attenuation factor for second multipath signal


% ****************** TEST INPUT SETUP - DO NOT MODIFY **************************

if input_type == 1
	if test_input_type == 1
		%specify BINARY input bit-by-bit
		data_in = binary_data;
	end
	if test_input_type == 2
		%random input defined by parameters
		num_levels = 255;		%number of possible levels of a symbol
						%must be integer between 1-255
		data_samples = round(rand(1,num_symbols)*(num_levels-1));
		data_in = zeros(1,8*length(data_samples));
		for i = 1:length(data_samples)
			data_in(1 + (i-1)*8:(i-1)*8 + 8) = eight2bin(data_samples(i));
		end
	end
	if test_input_type == 3
		%data stream represents sine wave samples
		t = linspace(0,1,num_symbols)	%evenly space number of samples
		%take 8-bit samples of sine wave
		data_samples = round(127.5*sin(frequency*2*pi*t) +127.5)
		data_in = zeros(1,8*length(data_samples));
		for i = 1:length(data_samples)
			data_in(1 + (i-1)*8:(i-1)*8 + 8) = eight2bin(data_samples(i));
		end
	end
end
data_in
already_made_noise = 0;	% initialization (don't change)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -