错误使用 QPSKDemodulator The input must be a column vector. 出错 q (line 45) dataOut = qpskDemod(rxSig);
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
clc;
% 参数设置
N = 20; % 发射天线数
Nr = 3; % 接收天线数
NumRF = 2; % RF镜个数
numRF=2^NumRF;%RF镜个数对应的信道数量
SNR_dB = 15; % 信噪比 (dB)
SNR = 10^(SNR_dB/10); % 信噪比转换为线性尺度
% QPSK调制参数
M = 4; % 调制阶数 (QPSK)
k = log2(M); % 每个符号的比特数
Es = 1; % 符号能量
Eb = Es/k; % 每比特能量
% 生成随机比特序列,确保总比特数可以被 (N*k) 整除
numBits = 1e5;
numBits = numBits - mod(numBits, N*k); % 确保整除
dataIn = randi([0 1], numBits, 1);
% QPSK调制
qpskMod = comm.QPSKModulator('BitInput', true);
txSig = qpskMod(dataIn); % 直接使用生成的比特序列
% RIS配置
H1 = (randn(N, numRF) + 1i*randn(N, numRF))/sqrt(2); % 发射天线到RF镜的信道
H2 = (randn(Nr,numRF) + 1i*randn(Nr,numRF))/sqrt(2); % RF镜到接收天线的信道
Phi = diag(exp(1i*2*pi*rand(numRF,1))); % RF镜相位调整
% 信道传输
% 调整txSig的形状以适配H1
txSig_reshaped = reshape(txSig, N, []); % 调整txSig的形状为 N x (length(txSig)/N)
% 确认计算的维度
composite_channel = H1' * txSig_reshaped; % 正确计算应为 numRF x M
% 通过Phi (numRF x numRF) 和 H2 (numRF x Nr)处理信号
% Phi * composite_channel 的结果为 numRF x M
% H2 * (Phi * composite_channel) 的结果为 Nr x M
rxSig = sqrt(SNR/N) * H2 * Phi * composite_channel + (randn(Nr, size(composite_channel, 2)) + 1i*randn(Nr, size(composite_channel, 2)))/sqrt(2);
% 接收端处理
qpskDemod = comm.QPSKDemodulator('BitOutput', true);
dataOut = qpskDemod(rxSig);
% 计算BER
[numErrors, ber] = biterr(dataIn, dataOut);
fprintf('BER = %f\n', ber);
0 comentarios
Respuestas (1)
Andreas Goser
el 7 de Mayo de 2024
From the basic programming, this can be explained like this:
rxSig is a 3x2500 matrix when you call qpskDemod. It means it is not a column vector.
The question now is whether this already helps you, or if there is a need to understand the application as a whole?
0 comentarios
Ver también
Categorías
Más información sobre Big Data Processing en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!