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

📄 ofdm_basic.m

📁 OFDM信道估计和均衡的仿真程序
💻 M
字号:
%+----------------------------------------------------------------+
%|                                                                |
%|  Name: ofdm.m                                                  |
%|  Author: Mathew Liu, James Shen                                |
%|  Description: Basic OFDM model used for simulation purposes.   |    
%|  This is meant to provide a skeleton for further               |
%|  implmentations. Channel estimates, Equalizers and bandpass    |
%|  models will be built on top of this.                          |
%|  Requirements: closest.m, qammod.m, qamdemod.m                 |
%|                                                                |
%+----------------------------------------------------------------+

% We assume that with are using 64 length FFT with 64 subcarriers all carrying
% data. So there are no carriers specifically assigned to pilot.
clear all;
close all;
%============= Some standard Hyperlan Params ======================
%--- These params are not used in this particular model------------
T = 50e-9; % System sampling period 
fs = 1/T; % System sampling freq = 20MHz 
Tcp = 16*T; % CP period
Tu = 64*T; % Useful symbol period
Ts = Tu+Tcp; % OFDM Symbol period 80 samples
delta_f = 0.3125e6; % Frequency spacing

%============== Our params based on Hyperlan/2 ====================
FFTLen = 64; % Length of FFT.
CPLen = 16;  % Length of Cyclic Prefix
M = 4;       % Bits encoded in a QAM symbol.

%+----------------------------------------------------------------+
%|                    OFDM   TRANSMITTER                          |
%+----------------------------------------------------------------+
%======== Data Generation =========================================
input = rand(1,FFTLen*M) > 0.5; % Binary data generation

%======== Serial To Block (FFTLen, M) =============================
input_para = reshape(input,FFTLen,M);

%======== Baseband Modulation =====================================
input_symbols = qammod(input_para,FFTLen, M);

%================= IFFT ===========================================
input_time_para = ifft(input_symbols);

%================ Parallel to Serial ==============================
input_time_serial = reshape(input_time_para,1,FFTLen); % Time domain signal

%=============  Gaurd Interval Removal (GII) ======================
input_ext = [input_time_serial((FFTLen-CPLen+1):FFTLen),input_time_serial];

%+----------------------------------------------------------------+
%|                    CHANNEL MODEL                               |
%+----------------------------------------------------------------+
%=============== Pass Through Rayleigh Channel ==========
output_ext = filter(1, 1, input_ext); % Does nothing at the moment.

%+----------------------------------------------------------------+
%|                    OFDM   RECEVIER                             |
%+----------------------------------------------------------------+
%============== Gaurd Interval Removal (GIR) ======================
output_time_serial = output_ext((CPLen+1):FFTLen+CPLen);

%======== Serial To Parallel ======================================
output_time_para = reshape(output_time_serial,FFTLen,1);

%================= FFT ============================================
output_symbols = fft(output_time_para);

%================= Baseband Demodulation ==========================
output_para = qamdemod(output_symbols,FFTLen, M);

%================ Parallel to Serial ==============================
output = reshape(output_para,1,FFTLen*M); % Time domain signal

%================ Error Calculation ===============================
% Error is ZERO, so it works.
error1= input - output;
figure(1);
semilogy(abs(error1).^2);

%====================== End File ==================================









⌨️ 快捷键说明

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