extracting elements from rows and columns

i have a input matrix of size
ofdm_symbol=randn(8,10,2)+(1j*randn(8,10,2))
the size of this matrix is 8x10x2
i want to access specific rows and columns and pad with zeros in the code
time_domain_signal=abs(ifft([ofdm_symbol(:,1:(end/2)-1,ii) zeros(N,(L-1)*N,ii(1:k1))
ofdm_symbol(:,5:8,ii(1:k1))])
and it gives the error as
Dimensions of matrices being concatenated are not consistent.
can you help me in debugging the code

댓글 수: 9

We do not know what N or L are.
ABDUL
ABDUL 2018년 2월 7일
N=8 and L=4
ABDUL
ABDUL 2018년 2월 7일
편집: Walter Roberson 2018년 2월 7일
this is the sample code for 2d matrix of the ofdm_symbol of
ofdm_symbol=randn(52,64,2)+(1j*randn(52,64,2))
code is
time_domain_signal=abs(ifft([ofdm_symbol(i,1:32) zeros(1,(L-1)*N) ofdm_symbol(i,33:64)]));
N=64 and L=4;
That latest code has a problem if i is a vector.
In the earlier code,
time_domain_signal=abs(ifft([ofdm_symbol(:,1:(end/2)-1,ii) zeros(N,(L-1)*N,ii(1:k1))
ii appears to be a vector of unknown length.
If ofdm_symbol is 8 x 10 x 2, then ofdm_symbol(:,1:(end/2)-1,ii) is 8 x 4 x length(ii)
zeros(N,(L-1)*N,ii(1:k1) is 8 x (4-1)*8=12 x (k1 more dimensions)
The 8 rows matches, and the number of columns does not need to match for the [] operator, but unless k1 = 1 and ii(1) = 2, the (k1 more dimensions) is not going to match the x 2 of ofdm_symbol
ABDUL
ABDUL 2018년 2월 7일
ii is a vector of length 2
ABDUL
ABDUL 2018년 2월 7일
편집: Walter Roberson 2018년 2월 7일
this is the sample code of 2d matrix
time_domain_signal=abs(ifft([ofdm_symbol(i,1:32) zeros(1,(L-1)*N) ofdm_symbol(i,33:64)]));
i want to obtain the same fragment for 3d matrix
The code
time_domain_signal=abs(ifft([ofdm_symbol(i,1:32) zeros(1,(L-1)*N) ofdm_symbol(i,33:64)]));
for vector i needs to be
time_domain_signal=abs(ifft([ofdm_symbol(i,1:32) zeros(length(i),(L-1)*N) ofdm_symbol(i,33:64)]));
ABDUL
ABDUL 2018년 2월 8일
i am getting the result for the code segment . but i want to modify the same code for obtaining in the 3d matrix.
Your code fragment
zeros(N,(L-1)*N,ii(1:k1))
does not work with a 3D matrix unless k1 happens to be exactly 1: if k1 is greater than 1, then 1:k1 is a vector and ii(1:k1) would be a vector of sizes. If any of those other than the first was something other than 1, then you would be working with an array of at least 4 dimensions.
In the phrase
[ofdm_symbol(:,1:(end/2)-1,ii) zeros(N,(L-1)*N,ii(1:k1))
ofdm_symbol(:,5:8,ii(1:k1))]
the number of rows needs to match (which it appears to do). But the number of pages (third dimension) also needs to match, so size(ofdm_symbol(:,1:(end/2)-1,ii),3) needs to match size(zeros(N,(L-1)*N,ii(1:k1)),3) and size(zeros(N,(L-1)*N,ii(1:k1)),4) upwards need to be 1. size(ofdm_symbol(:,1:(end/2)-1,ii),3) is length(ii) . size(zeros(N,(L-1)*N,ii(1:k1)),3) is ii(1). size(zeros(N,(L-1)*N,ii(1:k1)),4) upwards are ii(2) through ii(k1)

답변 (0개)

이 질문은 마감되었습니다.

태그

질문:

2018년 2월 7일

마감:

2021년 8월 20일

Community Treasure Hunt

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

Start Hunting!

Translated by