Basic Matlab Code for Transmission.rar

  • dwiky
    了解作者
  • matlab
    开发工具
  • 7KB
    文件大小
  • rar
    文件格式
  • 0
    收藏次数
  • 1 积分
    下载积分
  • 0
    下载次数
  • 2020-03-24 02:08
    上传日期
Basic Matlab Code for Transmission
Basic Matlab Code for Transmission.rar
  • MATLAB
  • OFDM.m
    3.3KB
  • ASK.m
    1.4KB
  • QAM64.m
    200B
  • BPSK.m
    184B
  • QAM.rar
    239B
  • Mapper_QPSK.m
    182B
  • Demapper_QPSK.m
    209B
  • Diffiehilmantest.m
    1.1KB
  • Mapping_8PSK.m
    185B
  • OFDM.rar
    1.4KB
  • FSK.m
    1.2KB
  • QAM.m
    200B
  • MATLAB.rar
    849B
内容介绍
clc; clear all; close all; %% setting input R = 1e5; %bits/sec alp = 2 p = 7 M = 64; %input('masukan nilai M-Array : '); k = log2(M); N = 128; %Mp = 4; n = 4096; %input('Masukan jumlah bit yang diinginkan : '); SNR = 0:1:30; zdbs=[2:.1:15]; NCP = 16 Nsym = 4; %filter order in symbol duration beta = 0.5; %roll off factor sampspersym = 10; %upsampling factor L = Nsym*sampspersym + 1; %raised cosine filter order Fs = R * sampspersym; f1 = Fs/5; cyclic_prefix_signal = []; iterasi = 1 for iter=1:iterasi %% input generator xin = randi([0 1],1,n); %% merubah bit ke desimal for i=1:length(xin)/k inmod(1,i)=bi2de(xin(1,k*i+1-k:k*i),'left-msb'); end %% modulasi qam mod=qammod(inmod,M); ytx=mod; %% Serial to Paralel t_s2p= []; for j = 1:length(ytx)/(N) t_s2p(j,1:N) = ytx(((N)*j+1)-(N):(N)*j); end; %% IFFT PAPR for it=1:size(t_s2p,1) ifft_signal = ifft(t_s2p(it,:)); ifft_signal_total(it,:) = ifft_signal pt = abs(ifft_signal); papr_db(it) = 10*log10(max(abs(pt).^2)/mean(abs(pt)).^2); end %% Calculate PAPR for w=1:length(zdbs) CCDF_ofdm(w)=length(find(papr_db>=zdbs(w)))/length(papr_db); end ccdf_ofdm = mean(CCDF_ofdm,1) %% add CP t_cp = [ifft_signal_total(:,(N-NCP)+1:N) ifft_signal_total]; %% P/S t_p2s=[]; for j=1:size(t_cp,1); t_p2s(1,((N+NCP)*j+1)-(N+NCP):(N+NCP)*j)=t_cp(j,:); end; %% Kanal ind=1 for snr=SNR outawgn = awgn(t_p2s,snr-10*log10(log2(M)),'measured'); %outawgn_ops8 = awgn(t_p2s_ops8,SNR-10*log10(log2(M)),'measured'); %% S/P r_s2p = []; for j = 1:length(outawgn)/(N+NCP) r_s2p(j,1:N+NCP) = outawgn(((N+NCP)*j+1)-(N+NCP):(N+NCP)*j); end; %% remove cp r_rem_cp = r_s2p(:,NCP+1:end); %% FFT for it=1:size(r_rem_cp,1) fft_signal = fft(r_rem_cp(it,:)); fft_signal_total(it,:) = fft_signal end %% P/S r_p2s=[]; for j=1:size(fft_signal_total,1); r_p2s(1,((N)*j+1)-(N):(N)*j)=fft_signal_total(j,:); end; %% Demod yrx_demod = qamdemod(r_p2s,M) %% desimal to bit r_bit=de2bi(yrx_demod,'left-msb'); r_bit_ser=[]; for i=1:size(r_bit,1) yrx(1,k*i+1-k:k*i)=r_bit(i,:); end; %% Calculating BER [nErr,BER(iter,ind)] = symerr(xin(1:length(yrx)),yrx); ind=ind+1 end %BER end ber=mean(BER,1) %ccdf = mean(CCDF_ofdm,1); %ccdf_ops_2 = mean(CCDF_ops_2,1) %ccdf_ops_4 = mean(CCDF1_ops_4,1) %ccdf_ops_8 = mean(CCDF_ops_8,1) %ccdf_ops_16 = mean(CCDF_ops_16,1) %% Kanal %% PAPR CCDF figure(1); semilogy(zdbs,ccdf_ofdm,'r--h','LineWidth',1); hold on; grid on; %semilogy(zdbs,ccdf_ops_4,'m--*','LineWidth',1); %semilogy(zdbs,ccdf_ops_8,'r--h','LineWidth',1); %semilogy(zdbs,ccdf_ops_16,'b--o','LineWidth',1); title('Peak to Average Power Ratio Graph'); xlabel('PAPR(dB)'); ylabel('CCDF(Pr[PAPR>PAPR0])'); %legend('OFDM'); %% Calculte BER figure(2); semilogy(SNR,ber,'b--*','LineWidth',1); hold on; grid on; %semilogy(zdbs,ccdf_ops_4,'m--*','LineWidth',1); %semilogy(zdbs,ccdf_ops_8,'r--h','LineWidth',1); %semilogy(zdbs,ccdf_ops_16,'b--o','LineWidth',1); title('Bit Error Rate Graph'); xlabel('Signal to Noise Ratio(SNR)(dB)'); ylabel('Bit Error Rate(BER)'); %legend('OFDM');
评论
    相关推荐
    • ldpc matlab
      基于matlab的仿真,通过bpsk调制,AWGN信道
    • MATLAB Deep Learning
      MATLAB Deep Learning》matlab深度学习2017年书籍及matlab源代码
    • matlab开发-Economicemissiondispatch
      matlab开发-Economicemissiondispatch。该软件采用二次规划法求解经济排放调度问题。
    • 霍夫曼编码matlab代码实现-Image-Compression-and-Transmission:Matlab中的无损图像压
      夫霍曼编码matlab代码实现图像压缩传输 Matlab 图像压缩中的无损图像压缩和传输是通过霍夫曼编码和解码算法完成的。 霍夫曼编码算法由优先队列实现。
    • MATLAB仿真资料
      MATLAB仿真资料 sr=256000.0; % Symbol rate ml=4; % ml:Number of modulation levels (BPSK:ml=1, QPSK:ml=2, 16QAM:ml=4) br=sr .* ml; % Bit rate nd = 1000; % Number of symbols that simulates in each loop ...
    • MATLAB Deep Learning
      深度学习资料,matlab版本。原版电子书,无水印,无笔记。
    • matlab qpsk
      qpsk matlab代码,介绍了qpsk从信号产生调制传输解调的全过程,并提供了误码率测试等内容。
    • zigbeephy-matlab
      zigbee物理层源码,用matlab实现,是初学zigbee很好的资料
    • matlab仿真代码
      Simulation of Communication Systems Modeling, Methodology and Techniques Kluwer Academic Publishers(2nd) 配套的代码,仿真需要的人来下。书有点大,需要的话回复一下 我再上 Matlab
    • GaussDB_100_1.0.1-DATABASE-REDHAT-64bit.tar.gz
      guassdb100在redhat上安装包,单机部署的包,安装步骤请看我的文中介绍,经过大量实验搭建总结出来的文档