您现在的位置:首页 >> 技术文章 >> 通信信号处理 >> 内容

MATLAB代做|FPGA代做-OFDM在瑞利信道下的误码率源码程序

时间:2021-1-3 0:07:24 点击:

  核心提示:MATLAB代做|FPGA代做-OFDM在瑞利信道下的误码率源码程序...
%% Program to plot the BER of OFDM in Frequency selective channel

clc;
clear all;
close all;
N = 128;                                                % No of subcarriers
Ncp = 16;                                               % Cyclic prefix length
Ts = 1e-3;                                              % Sampling period of channel
Fd = 0;                                                 % Max Doppler frequency shift
Np = 4;                                                 % No of pilot symbols
M = 2;                                                  % No of symbols for PSK modulation
Nframes = 10^3;                                         % No of OFDM frames
D = round((M-1)*rand((N-2*Np),Nframes));
const = pskmod([0:M-1],M);
Dmod = pskmod(D,M);
Data = [zeros(Np,Nframes); Dmod ; zeros(Np,Nframes)];   % Pilot Insertion

%% OFDM symbol

IFFT_Data = (128/sqrt(120))*ifft(Data,N);
TxCy = [IFFT_Data((128-Ncp+1):128,:); IFFT_Data];       % Cyclic prefix
[r c] = size(TxCy);
Tx_Data = TxCy;

%% Frequency selective channel with 4 taps

tau = [0 1e-5 3.5e-5 12e-5];                            % Path delays
pdb = [0 -1 -1 -3];                                     % Avg path power gains
h = rayleighchan(Ts, Fd, tau, pdb);
h.StoreHistory = 0;
h.StorePathGains = 1;
h.ResetBeforeFiltering = 1;

%% SNR of channel

EbNo = 0:5:30;
EsNo= EbNo + 10*log10(120/128)+ 10*log10(128/144);      % symbol to noise ratio
snr= EsNo - 10*log10(128/144); 

%% Transmit through channel

berofdm = zeros(1,length(snr));
Rx_Data = zeros((N-2*Np),Nframes);
for i = 1:length(snr)
    for j = 1:c                                         % Transmit frame by frame
        hx = filter(h,Tx_Data(:,j).');                  % Pass through Rayleigh channel
        a = h.PathGains;
        AM = h.channelFilter.alphaMatrix;
        g = a*AM;                                       % Channel coefficients
        G(j,:) = fft(g,N);                              % DFT of channel coefficients
        y = awgn(hx,snr(i));                            % Add AWGN noise

%% Receiver
    
        Rx = y(Ncp+1:r);                                % Removal of cyclic prefix 
        FFT_Data = (sqrt(120)/128)*fft(Rx,N)./G(j,:);   % Frequency Domain Equalization
        Rx_Data(:,j) = pskdemod(FFT_Data(5:124),M);     % Removal of pilot and Demodulation 
    end
    berofdm(i) = sum(sum(Rx_Data~=D))/((N-2*Np)*Nframes);
end

%% Plot the BER

figure;
semilogy(EbNo,berofdm,'--or','linewidth',2);
grid on;
title('OFDM BER vs SNR in Frequency selective Rayleigh fading channel');
xlabel('EbNo');
ylabel('BER');

联系:highspeedlogic

QQ :1224848052

微信:HuangL1121

邮箱:1224848052@qq.com

网站:http://www.mat7lab.com/

网站:http://www.hslogic.com/

微信扫一扫:

Tags:OFDM 
作者:OFDM 来源:网络OFDM
  • 您是如何找到本站的?
  • 百度搜索
  • Google搜索
  • 查阅资料过程中
  • 论坛发现
  • 百度贴吧发现
  • 朋友介绍
本站最新成功开发工程项目案例
相关评论
发表我的评论
  • 大名:
  • 内容:
  • matlab代做|matlab专业代做|matlab淘宝代做|python人工智能代做|FPGA项目合作|C代做|C++代做(www.hslogic.com) © 2021 版权所有 All Rights Reserved.
  • Email:highspeed_logic@163.com 站长QQ: 1224848052

    专业代做/代写/承接、MATLAB、SIMULINK、FPGA项目、博士/硕士/本科毕业设计、课题设计、论文,毕业论文,Coursework、Eassy、Assignment