error in matrix concatenation using the loop

i am unable to concatenate to my desirable length. y1 is of dimension 16x99, y2 is of dimension 16x99, y_in and y_qd must be of dimension 16x396 but i am getting it as a 1x6336 during concatenation .
help in concatenation of the matrix will be appreciated
help me in this regards
data_NRZ=[ -1 -1 -1 -1 1 1 1 1 ;
-1 -1 -1 -1 -1 -1 1 -1;
1 -1 1 1 -1 -1 -1 1;
1 -1 1 -1 1 1 1 -1;
1 -1 1 1 1 1 -1 -1;
1 1 1 1 1 1 1 1;
1 1 1 -1 -1 -1 1 -1;
1 -1 1 -1 -1 -1 1 1 ];
tmod=[1.26262626262626e-09 2.52525252525253e-09 3.78787878787879e-09 5.05050505050505e-09 6.31313131313131e-09 7.57575757575758e-09 8.83838383838384e-09 1.01010101010101e-08 1.13636363636364e-08 1.26262626262626e-08 1.38888888888889e-08 1.51515151515152e-08 1.64141414141414e-08 1.76767676767677e-08 1.89393939393939e-08 2.02020202020202e-08 2.14646464646465e-08 2.27272727272727e-08 2.39898989898990e-08 2.52525252525253e-08 2.65151515151515e-08 2.77777777777778e-08 2.90404040404040e-08 3.03030303030303e-08 3.15656565656566e-08 3.28282828282828e-08 3.40909090909091e-08 3.53535353535354e-08 3.66161616161616e-08 3.78787878787879e-08 3.91414141414141e-08 4.04040404040404e-08 4.16666666666667e-08 4.29292929292929e-08 4.41919191919192e-08 4.54545454545455e-08 4.67171717171717e-08 4.79797979797980e-08 4.92424242424242e-08 5.05050505050505e-08 5.17676767676768e-08 5.30303030303030e-08 5.42929292929293e-08 5.55555555555556e-08 5.68181818181818e-08 5.80808080808081e-08 5.93434343434343e-08 6.06060606060606e-08 6.18686868686869e-08 6.31313131313131e-08 6.43939393939394e-08 6.56565656565657e-08 6.69191919191919e-08 6.81818181818182e-08 6.94444444444444e-08 7.07070707070707e-08 7.19696969696970e-08 7.32323232323232e-08 7.44949494949495e-08 7.57575757575758e-08 7.70202020202020e-08 7.82828282828283e-08 7.95454545454545e-08 8.08080808080808e-08 8.20707070707071e-08 8.33333333333333e-08 8.45959595959596e-08 8.58585858585859e-08 8.71212121212121e-08 8.83838383838384e-08 8.96464646464647e-08 9.09090909090909e-08 9.21717171717172e-08 9.34343434343434e-08 9.46969696969697e-08 9.59595959595960e-08 9.72222222222222e-08 9.84848484848485e-08 9.97474747474747e-08 1.01010101010101e-07 1.02272727272727e-07 1.03535353535354e-07 1.04797979797980e-07 1.06060606060606e-07 1.07323232323232e-07 1.08585858585859e-07 1.09848484848485e-07 1.11111111111111e-07 1.12373737373737e-07 1.13636363636364e-07 1.14898989898990e-07 1.16161616161616e-07 1.17424242424242e-07 1.18686868686869e-07 1.19949494949495e-07 1.21212121212121e-07 1.22474747474747e-07 1.23737373737374e-07 1.25000000000000e-07];
s_p_data=reshape(data_NRZ,16,4);
ymod=[];
ycomplex=[];
y_in=[];
y_qd=[];
for jmodsp=1:size(s_p_data,1)
for imod = 1:4
y1(jmodsp,:) = s_p_data((2*imod)-1,imod)*cos(2*pi*fc*tmod); % inphase component
y2(jmodsp,:) = s_p_data(2*imod,imod)*sin(2*pi*fc*tmod);% Quadrature component
y_in = [y_in y1(jmodsp,:)]; % inphase signal vector
y_qd = [y_qd y2(jmodsp,:)]; %quadrature signal vector
ymod = [ymod y1(jmodsp,:)+y2(jmodsp,:)]; % modulated signal vector
ycomplex = [ycomplex (sign(y1(jmodsp,:)))+(1i*sign(y2(jmodsp,:)))];
end
end

댓글 수: 6

Jan
Jan 2019년 7월 1일
Which matrices have the mentioned sizes? Which concatenation does not work as you want?
ABDUL
ABDUL 2019년 7월 1일
matrix when executed will have the following dimensions
y1= 16x99; y2=16x99; y_in=1x6336; y_qd=1x6336, ymod=1x6336 and ycomplex=1x6336;
i have to get the dimensions as y1=16x99, y2=16x99, y_in= 16x396 ; y_qd=16x396; ymod =16x396; ycomplex = 16x396;
Try using reshape to change the size of the arrays. Something like:
y_in = reshape(y_in,16,[]);
ABDUL
ABDUL 2019년 7월 1일
tried using it it will show an error ...
Why don't you post the entire error message for us and we can see if we can help.
ABDUL
ABDUL 2019년 7월 1일
if i am using the reshape the error message is this
Error using reshape
Product of known dimensions, 16, not divisible into total number of elements, 99.
if i am not using the reshape then there will be no error but it will compute the matrix of dimensions for y_in = 1x6336 , y_qd=1x6336, , ymod and ycomplex =1x6336

답변 (0개)

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

질문:

2019년 7월 1일

마감:

2021년 8월 20일

Community Treasure Hunt

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

Start Hunting!

Translated by