array dimensions must match in binary op

1 回表示 (過去 30 日間)
ABDUL
ABDUL 2018 年 2 月 17 日
回答済み: Image Analyst 2018 年 2 月 18 日
i am trying to implement the SLM for mimo ofdm system i tried implementing it. there is some error can any one help in this regard
N=64; % number of subbands
L=4; % oversampling factor
C=16; % number of OFDM symbol candidates
Nt=2; %number of transmitters
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% phase factor matrix [B] generation
p=[1 -1 1j -1j]; % phase factor possible values
randn('state', 12345);
B=randsrc(C,N,p); % generate N-point phase factors for each one of the
% C OFDM candidates
for ii=1:Nt
for n=1:C
for n1=1:N
B_1(n,:,:)=B(:,:);
end
end
end
ofdm_symbol=randn(100,64,2)+(1j*randn(100,64,2));
for i=1:NN
some instructuions ….
p=[];
for k=1:C
p=[p; B_1(k,:,:).*ofdm_symbol(1:NN,:,:)];
end
end
I am getting the error message as
Error:
Array dimensions must match for binary array op.
p=[p; B_slm(k,:,:).*ofdm_symbol(1:NN,:,:)];
  2 件のコメント
Walter Roberson
Walter Roberson 2018 年 2 月 17 日
In your code
for n=1:C
for n1=1:N
B_1(n,:,:)=B(:,:);
end
end
neither your left hand side of the assignment nor the right hand side of the assignment depend upon n1, so it is not clear why you have the for n1 loop there?
ABDUL
ABDUL 2018 年 2 月 18 日
@walter : i want to have the multiple pages of phase vector. i have modified the code one more time i am getting the same error.
NN=100;
N=64; % number of subbands
L=4; % oversampling factor
C=100; % number of OFDM symbol candidates
Nt=2; %number of transmitters
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% phase factor matrix [B] generation
p=[1 -1 1j -1j]; % phase factor possible values
randn('state', 12345);
B=randsrc(C,N,p); % generate N-point phase factors for each one of the
% C OFDM candidates
% x = rand(16, 64);
% y = repmat(x, 1, 1, 2);
for ii_slm=1:Nt
for n=1:C
for n1=1:N
B_1(:,:,ii_slm)=B;
end
end
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ofdm_symbol=randn(100,64,2)+(1j*randn(100,64,2));
for i=1:NN
some instructions…………
p=[];
for k=1:C
p=[p; B_1(k,:,:).*ofdm_symbol(1:NN,:,:)];
end
end
I am getting the error message as
Array dimensions must match for binary array op.
Error in selected_mapping_mimo
p=[p; B_1(k,:,:).*ofdm_symbol(1:NN,:,:)];
i am unable to find the error.

サインインしてコメントする。

採用された回答

Image Analyst
Image Analyst 2018 年 2 月 18 日
In a 3D array, let's call the first index rows, the second index columns, and the last index slices. So when you do
B_1(k,:,:).*ofdm_symbol(1:NN,:,:)
even if the last two indexes are the same size, in the B_1 array you're taking one row, while in the ofdm_symbol array, you're taking NN rows. So unless NN = 1, you're not multiplying the same number of elements, which you must to be a valid element-by-element multiplication.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeTransmitters and Receivers についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by