2015-11-14 96 views
0

這個問題似乎並不重要,但在嘗試解決問題時我還是搔着頭。我試圖對64 QAM星座應用具有恆模技術的分數間隔均衡器。該方案適用於QPSK或4 QAM,但是當我把它應用到64QAM,它拋出錯誤:Matlab:使用高階QAM信號時出現錯誤 - 矩陣尺寸必須一致

Error using/
Matrix dimensions must agree. 

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

我不想沒有通訊工具箱使用應答使已經產生了64QAM的符號在我剛纔的問題Generate 16 QAM signal

給出

有人可以幫助使代碼工作?謝謝。

% 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 
+0

做'fh(temp)'時'temp'的維數是多少?我的猜測是會比一個更大。 –

+0

對於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); – SKM

+0

另一個主要的不合理編輯。請讓我知道您進行這些修改的原因,或者如果您希望將其滾回,以防我認爲適當地邀請主持人。謝謝。 – halfer

回答

0

主要問題是迭代算法沒有收斂(或更具體的發散)。作爲結果,f中的值包含NaN。的

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

所以,結果是空的載體,它因此不就行了

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

符合預期的標量大小要解決這個問題,你可能會注意到的mu價值和R2你使用基於具有單位差異的信號星座。可以生成這種具有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)可以幫助您以一致的清理狀態開始執行。

+0

謝謝您的回覆,但不清楚爲什麼您將sqrt分爲42?爲什麼數字42?另一件事,當我應用你給出的陳述和temp變量爲空時,我仍然得到相同的錯誤。 – SKM

+0

我忘記了規範因素是42.所以,現在已經很清楚了。但是,問題仍然存在。請幫助,以便代碼可以工作。 – SKM

+0

嗨,代碼仍然拋出錯誤和符號錯誤率計算也不起作用後,我根據您的建議進行更改 – SKM