where is the wrong this code!
显示 更早的评论
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
% Plot BER results
semilogy(1:length(modulations), ber, '-o');
xlabel('Modulation');
ylabel('BER');
xticks(1:length(modulations));
xticklabels(modulations);
grid on;
回答(1 个)
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 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!