want help to correct cdma code

Status
Not open for further replies.

aniket18

Junior Member level 3
Joined
Jan 14, 2011
Messages
25
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,283
Activity points
1,446
i am posting my code...i got some error in first for loop ...i got the error message ??? Subscripted assignment dimension mismatch.
Error in ==> test2 at 22
dd,v)=i,r:r+7);


here it is code please correct ...i think the matrix formation is not correct could any body correct it...


clc;
clear all;
h=hadamard (8);
r=10000;

%orthogonal walsh code
q=h(1,;

u=randint(1,r); %random data generation

%bpsk modulation
d=2*u-1;

%spreading
i11=kron(d,h);

i=i11;

% arranging the data in 8x10000 matrix
v=1;
for r=1:8:8*r
dd,v)=i,r:r+7);
v=v+1;
end

n0=-2:10;

%adding noise

for s=1:length(n0)
y=awgn(dd,n0(s));

% despreading
for ss=1:r

rr,ss)=dot(y,ss),q);
% decoding to 0's and 1's
ra,ss)=rr,ss)>0;

end
% Error count
err_u=size(find([u-ra]),2);

end

%BER

ber_u= err_u/r
semilogy(n0,ber_u,'linewidth',2);
grid on;
hold on;
 

The error message means, that you have accessed an array with not matching indices.

Without showing us the corresponding commands, there is definitely no chance to tell you how to fix them.
subscripted expression to be assigned doesn't agree w/ a target in dimension
 

tahnk you for your reply ..

but i dont understand which commands...

i got error in the following for loop which is present in the code

% arranging the data in 8x10000 matrix
v=1;
for r=1:8:8*r
dd,v)=i,r:r+7);
v=v+1;
end
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…