【问题标题】:Matlab: Error when working with higher order QAM signal - Matrix dimension must agreeMatlab:使用高阶 QAM 信号时出错 - 矩阵维度必须一致
【发布时间】:2016-02-15 17:54:58
【问题描述】:

这个问题似乎是微不足道的,但当我试图解决它时,我却摸不着头脑。我正在尝试将具有恒定模数技术的分数间隔均衡器应用于 64 QAM 星座。该程序适用于 QPSK 或 4 QAM,但是当我将其应用于 64QAM 时,它会引发错误:

Error using  / 
Matrix dimensions must agree.

Error in Working_FSE_CMA_64QAM (line 68)
sb1=sb/(fh(temp));  % scale the output

我没有通信工具箱,因此使用我上一个问题Generate 16 QAM signal 中给出的答案生成了 64QAM 符号

有人可以帮助使代码正常工作吗?谢谢。

% Blind channel estimation/equalization
% adpative CMA method in Fractional space

T=1000;    % total number of data
dB=25;     % SNR in dB value

%%%%%%%%% Simulate the Received noisy Signal  %%%%%%%%%%%
N=5; % smoothing length N+1
Lh=5;  % channel length = Lh+1
Ap=4;  % number of subchannels or receive antennas

h=randn(Ap,Lh+1)+sqrt(-1)*randn(Ap,Lh+1);   % channel (complex)
for i=1:Ap, h(i,:)=h(i,:)/norm(h(i,:));    end        % normalize
s = (randi(8,1,T)*2-5)+j*(randi(8,1,T)*2-5);  %64 QAM
%s=round(rand(1,T))*2-1;  % QPSK or 4 QAM symbol sequence
%s=s+sqrt(-1)*(round(rand(1,T))*2-1);

% generate received noisy signal
x=zeros(Ap,T);    % matrix to store samples from Ap antennas
SNR=zeros(1,Ap);
for i=1:Ap
    x(i,:)=filter(h(i,:),1,s);
    vn=randn(1,T)+sqrt(-1)*randn(1,T);   % AWGN noise (complex)
    vn=vn/norm(vn)*10^(-dB/20)*norm(x(i,:));  % adjust noise power
    SNR(i)=20*log10(norm(x(i,:))/norm(vn));   % Check SNR of the received samples
    x(i,:)=x(i,:)+vn;                        % received signal
end
SNR=SNR    % display and check SNR

%%%%%%%%%%%%% adaptive equalizer estimation via CMA
Lp=T-N;   %% remove several first samples to avoid 0 or negative subscript
X=zeros((N+1)*Ap,Lp);  % sample vectors (each column is a sample vector)
for i=1:Lp
    for j=1:Ap
        X((j-1)*(N+1)+1:j*(N+1),i)=x(j, i+N:-1:i).';
    end
end

e=zeros(1,Lp);  % used to save instant error
f=zeros((N+1)*Ap,1); f(N*Ap/2)=1;    % initial condition
%R2=2;                  % constant modulas of QPSK symbols
R2 = 1.380953; %For 64 QAM http://www.google.com/patents/US7433400
mu=0.001;      % parameter to adjust convergence and steady error
for i=1:Lp
   e(i)=abs(f'*X(:,i))^2-R2;                  % instant error
   f=f-mu*2*e(i)*X(:,i)*X(:,i)'*f;     % update equalizer 
   f(N*Ap/2)=1;
%   i_e=[i/10000 abs(e(i))]             % output information 
end   

%sb=f'*X;   % estimate symbols (perform equalization)
sb = filter(f, 1, X);
% calculate SER
H=zeros((N+1)*Ap,N+Lh+1);  temp=0;
for j=1:Ap
    for i=1:N+1, temp=temp+1; H(temp,i:i+Lh)=h(j,:); end  % channel matrix
end

fh=f'*H;    % composite channel+equalizer response should be delta-like 
temp=find(abs(fh)==max(abs(fh)));   % find the max of the composite response

sb1=sb/(fh(temp));  % scale the output
sb1=sign(real(sb1))+sqrt(-1)*sign(imag(sb1));  % perform symbol detection
start=N+1-temp;  % general expression for the beginning matching point
sb2=sb1(10:length(sb1))-s(start+10:start+length(sb1));  % find error symbols
SER=length(find(sb2~=0))/length(sb2)   % calculate SER

if 1
    subplot(221), 
    plot(s,'o');   % show the pattern of transmitted symbols
    grid,title('Transmitted symbols');  xlabel('Real'),ylabel('Image')
    axis([-2 2 -2 2])

    subplot(222),
    plot(x,'o');  % show the pattern of received samples
    grid, title('Received samples');  xlabel('Real'), ylabel('Image')

    subplot(223),
    plot(sb,'o');   % show the pattern of the equalized symbols
    grid, title('Equalized symbols'), xlabel('Real'), ylabel('Image')

    subplot(224),
    plot(abs(e));   % show the convergence
    grid, title('Convergence'), xlabel('n'), ylabel('Error e(n)')
end

【问题讨论】:

  • 在做fh(temp)temp的维度是多少?我的猜测是它会大于一。
  • 对于 4 QAM 或 QPSK,temp 是值为 9 的标量。对于 64 QAM,temp 为空。这让我感到困惑,不知道该怎么办。我是否正确生成 64 QAM?我是否需要使用以下语句: s = (randi(8,1,T)*2-5)+j*(randi(8,1,T)*2-5);和 s=s+sqrt(-1)*(round(rand(1,T))*2-1);
  • 又一次重大的不合理编辑。请让我知道您进行这些编辑的原因,或者如果您希望将它们回滚,以防我认为让主持人参与是合适的。谢谢。

标签: matlab matrix signal-processing equalizer modulation


【解决方案1】:

主要问题是迭代算法不收敛(或者更具体地说是发散)。结果f 中的值包含NaN。结果

temp=find(abs(fh)==max(abs(fh)))

然后是一个空向量,因此与行上的预期标量大小不匹配

sb1=sb/(fh(temp));  % scale the output

要解决此问题,您可能会注意到您使用的muR2 的值是基于具有单位方差的信号星座。您可以使用以下方法生成这样的 64-QAM 星座:

s = ((randi(8,1,T)*2-9)+j*(randi(8,1,T)*2-9))/sqrt(42);  %64 QAM

另外,几行代码重新定义了复杂常量j=sqrt(-1) 以用作索引变量。您应该避免使用j 作为索引。此外,清除脚本开头的所有变量(使用clear all)可以帮助您以一致的干净状态开始执行。

【讨论】:

  • 谢谢你的回复,但不清楚你为什么要除以42的sqrt?为什么是数字 42?另一件事,当我应用你给出的语句并且 temp 变量为空时,我仍然遇到同样的错误。
  • 我忘记了标准因子是 42。所以,现在很清楚了。但是,问题仍然存在。请帮助,以便代码可以工作。
  • 您好,在我根据您的建议进行更改后,代码仍然抛出错误并且符号错误率计算也不起作用
  • 行 sb2=sb1(10:length(sb1))-s(start+10:start+length(sb1));也在制造麻烦
  • fh 是一个大小为N+Lh+1 的向量(因此是1<=temp<=N+Lh+1)。因此,您的计算 start=N+1-temp 可能会产生负偏移量(对于 Lh>=10,超出范围的索引到 s)。对于符号错误,存在许多问题,包括缺乏相位恢复和基于阈值检测的符号检测方案适用于 4-QAM(而不是选择最接近的符号),但这超出了最初的问题。
猜你喜欢
  • 2013-11-03
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-12-07
  • 2015-01-20
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多