i am facing this error in simulation . "" Error using * Inner matrix dimensions must agree. Error in Untitled77777 (line 65) decBits = step(pskDemodulator,v * H' * r1);"""" please help me to solve it .
1 次查看(过去 30 天)
显示 更早的评论
N = 2; % Number of transmit antennas
M = 2; % Number of receive antennas
EbNoVec = 2:3:8; % Eb/No in dB
modOrd = 4; % constellation size = 2^modOrd
% Create a local random stream to be used by random number generators for
% repeatability.
stream = RandStream('mt19937ar');
% Create PSK modulator and demodulator System objects
pskModulator = comm.PSKModulator(...
'ModulationOrder', 2^modOrd, ...
'PhaseOffset', 0, ...
'BitInput', true);
pskDemodulator = comm.PSKDemodulator( ...
'ModulationOrder', 2^modOrd, ...
'PhaseOffset', 0, ...
'BitOutput', true);
% Loop over selected EbNo points
for idx = 1:length(EbNoVec)
% Calculate SNR from EbNo for each independent transmission link
snrIndB = EbNoVec(idx) + 10*log10(modOrd);
snrLinear = 10^(0.1*snrIndB);
% Create random bit vector to modulate
msg = randi(stream, [0 1], [N*modOrd, 1]);
% Modulate data
txSig1 = step(pskModulator,msg);
xF1 = zeros(size(txSig1));
txSig22 = (idwt(txSig1,xF1,'haar')).';
txSig = reshape(txSig22,[2,2]);
% txSig = idct(txSig1);
% Flat Rayleigh fading channel with independent links
rayleighChan = (randn(stream, M, N) + 1i*randn(stream, M, N))/sqrt(2);
% Add noise to faded data
rxSig1 = awgn(rayleighChan*txSig, snrIndB, 0, stream);
rxSig = dwt(rxSig1,'haar');
% rxSig = dct(rxSig1);
% ZF-SIC receiver
r = rxSig;
H = rayleighChan; % Assume perfect channel estimation
% Initialization
estZF = zeros(N*modOrd, 1);
orderVec = 1:N;
k = N+1;
% Start ZF nulling loop
for n = 1:N
% Shrink H to remove the effect of the last decoded symbol
H = H(:, [1:k-1,k+1:end]);
% Shrink order vector correspondingly
orderVec = orderVec(1, [1:k-1,k+1:end]);
% Select the next symbol to be decoded
G = (H'*H) \ eye(N-n+1); % Same as inv(H'*H), but faster
size(G)
[~, k] = min(diag(G));
symNum = orderVec(k);
v = G(k,:)';
size(v)
% Hard decode the selected symbol
size(H)
size(r)
% size(G(k,:)
decBits = step(pskDemodulator,v * H' * r);
estZF(modOrd * (symNum-1) + (1:modOrd)) = decBits;
% Subtract the effect of the last decoded symbol from r
if n < N
r = r - H(:, k) * step(pskModulator,decBits);
end
end
end
0 个评论
回答(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!