Expected input to be a scalar.
조회 수: 4 (최근 30일)
이전 댓글 표시
this is my cod , i have problem at this ligne :
ofdm_symb_awgn_t=ifft(awgn( fft(ofdm_symb_t) , SNR, 'measured'));
close all;
clear all;
%% Ofdm parameteres %%
mod_order = 4; % Oder da modulaQAM
N =256; % Numero de sinais a ser modulado/tamaho do ODFDM symbol
vec_EbN0_dB_ofdm =0 : 2 : 20 ;
vec_SNR_dB_ofdm = vec_EbN0_dB_ofdm + 10 * log10( mod_order );
%SNR=18;
fading= 'yes';
for i=1:length(vec_EbN0_dB_ofdm)
var_ber_soma = 0;
var_ber(i) = 0;
iteracao = 0;
SNR(i) = vec_EbN0_dB_ofdm(i)+ 10*log10( log2(mod_order)) ;
while(var_ber_soma < 100)
i
iteracao = iteracao + 1
%tx
data_tx = randi([0,mod_order-1],N,1);
qam_symb_tx_f=qammod(data_tx,mod_order, 'UnitAveragePower', true);
ofdm_symb_t=ifft(qam_symb_tx_f, N);
if strcmpi(fading,'yes')
%Rayleigh channel
h = (randn+1i*randn)/sqrt(2);
H=fft(h, N).';
rayleigh_ofdm_symb= H .* qam_symb_tx_f;
elseif strcmpi(fading,'no')
h = 1;
H=fft(h, N).';
rayleigh_ofdm_symb= H .* qam_symb_tx_f;
end
%Adding AWGN / tem que ser na freq?
ofdm_symb_awgn_t=ifft(awgn( fft(ofdm_symb_t) , SNR, 'measured'));
ofdm_symb_awgn= awgn(rayleigh_ofdm_symb , SNR(i));%, 'measured');
%rx
%data_rx=qamdemod((ofdm_symb_awgn./H),mod_order, 'UnitAveragePower', true);
data_rx=qamdemod((ofdm_symb_awgn),mod_order, 'UnitAveragePower', true);
%SER
ser= sum(data_tx~=data_rx);
[SnumErrors,ser2] = symerr(data_tx,data_rx);
%BER
[BnumErrors, ber] = biterr(data_tx,data_rx);
var_ber_soma = var_ber_soma + ber
%var_ser(i) = ser2;
end
var_ber(i) = var_ber_soma/iteracao;
end
%semilogy(SNR,var_ber, 'r', 'MarkerSize', 2 );
semilogy(SNR,var_ber, 'c', 'MarkerSize', 3 );
ylim( [ 1e-6, 10000 ] ); xlim( [ 0, 20 ] );
grid on;
hold on ;
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Propagation and Channel Models에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!