i am attempting to debug a part of the code but getting this error:
??? Error using ==> plus
Matrix dimensions must agree.
Error in ==> dwtembed at 48
cH1=cH1+k*pn_sequence_h;
This is the code segment:
for kk=1:length(message_vector)
pn_sequence_h=round(2*(rand(Mc/2,Nc/2)-0.5));
pn_sequence_v=round(2*(rand(Mc/2,Nc/2)-0.5));
if (message(kk) == 0)
cH1=cH1+k*pn_sequence_h;
cV1=cV1+k*pn_sequence_v;
end
end
These are the values for the variables:
kk 18096
message_vector <150096x1 double>
pn_sequence_h <118x116 double>
Mc 236
Nc 232
pn_sequence_v <118x116 double>
cH1 <118x116x3 double>
cV1 <118x116x3 double>
k 2
Can you please help me out with the information provided.
You have mismatch dimensions. You are trying to add
CH1of size 118x116x3 (a 3D array) withon_sequence_hwhich is 118×116 (a 2D matrix). This operation is not definedYou may use
bsxfun: