where is the wrong in this code.i can't run this code
clear; clc;
% Modulation schemes to compare
modulations = {'BPSK', 'QPSK', '8-PSK', '16-QAM', '64-QAM'};
% Transmit power and data rate
P_t = 0.1; % W
R = 100e6; % bps
% Extinction coefficient
c = 0.15; % m^-1
% PIN PD parameters
eta = 0.82;
fc = 300e6; % Hz
% Rx parameters
d = 0.2; % m
f = 0.25; % m
fov = 0.69;
% BER calculation
for i = 1:length(modulations)
modulation = modulations{i};
% Assume ideal receiver for simplicity
[~, ber(i)] = berawgn(modulation, R, P_t);
end
Error using berawgn
EbNo must be a real vector.
% Plot BER results
semilogy(1:length(modulations), ber, '-o');
xlabel('Modulation');
ylabel('BER');
xticks(1:length(modulations));
xticklabels(modulations);
grid on;

답변 (1개)

Cris LaPierre
Cris LaPierre 2023년 1월 30일

0 개 추천

The first input to berawgn must be a scalar or vector. Your first input is a character vector that seems to what is expected as the second input (modtype).
The first input argument, EbNo, is the ratio of bit energy to noise power spectral density in dB (Eb/N0).
Consult the documentation to be sure you are supplying the inputs the function expects.

카테고리

도움말 센터File Exchange에서 PHY Components에 대해 자세히 알아보기

질문:

2023년 1월 30일

답변:

2023년 1월 30일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by