04-29-2012 11:06 AM
Program of Transmitter (matlab)
clear
clc
block=2;
n=1; %no.of users
m=2; %data length
sl=2; %spread length
chiplen=m*sl; %chip length
itnum=30;
ebnostart=0; %step iteration
ebnostep=3;
ebnonum=8;
%spreading sequence producing {+1,-1,+1,-1--------}
for i=1:sl
spreading(1,i)=1-2*rem(i-1,2);
end
%spreading sequence generation ends
%interleaving sequence generation begins
for i=1:n
for j=1:chiplen
scrambrule(i,j)=j;
first(i,j)=j;
end
for j=1:chiplen
k=j+rem(randint(1,1,1000)*randint(1,1,1000),(chiplen+1-j));
tmp=scrambrule(i,j);
scrambrule(i,j)=scrambrule(i,k);
scrambrule(i,k)=tmp;
end
end
%interleave design ends
%the simulation process begins
for z=1:ebnonum
ebno=ebnostart+z*ebnostep;
snr(z)=(10.^(ebno/10))/sl;
sigma=sqrt(0.5/snr(z));
error=0;
for bloc=1:block
%transmitter section begins
%generation of data randomly
for i=1:n
for j=1:m
data(i,j)=randint(1,1);
end
end
%end of generation of data
%data spreading begins
for i=1:n
l=1;
for j=1:m
tmp=1-2*data(i,j);
for s=1:sl
chip(i,l)=tmp*spreading(1,s);
l=l+1;
end
end
end
%end of data spreading
%transmitting data production begins
for i=1:n
for j=1:chiplen
transmit(i,j)=chip(i,scrambrule(i,j))
end
end
%transmitting data produced
%transmitter section ends
end
end
04-29-2012 11:23 AM
Hi dsk,
what do you expect here? Do you think someone will do your work? Come on...
You should:
- describe your problem more detailed
- attach, what you already converted to LabVIEW G
- tell us the LV version you're using
04-29-2012 02:19 PM
How to solve the problem:
There, problem solved. Oh, wait, that wasn't the question? Silly me.
Then perhaps you might want to look at this: http://www.catb.org/~esr/faqs/smart-questions.html
05-01-2012 11:11 AM
tmp=scrambrule(i,j);
scrambrule(i,j)=scrambrule(i,k);
scrambrule(i,k)=tmp;
in this how can inter change the vale for interleaver then this same problem is again data genration...
05-01-2012 11:56 AM
You're on the wrong site. http://www.mathworks.com/ is where you go to get Matlab code debugged and written.
05-03-2012 06:55 PM
I can not transform these line in labview sir.
how does I transform/write/design block of these lines in labview.
05-04-2012 01:55 AM - edited 05-04-2012 01:58 AM
Hi dsk,
when you're not able to program a simple element swap of a 2D array in LabVIEW I would suggest to go through the basics course offered by NI:
One more (maybe more intuitive) way:
05-06-2012 08:03 AM
And sir these line are also creating problem to design(in above whole program)
for s=1:sl
chip(i,l)=tmp*spreading(1,s);
l=l+1;
end
05-06-2012 11:18 AM
Hi dsk,
spreading(x,y) is just a 2D array, which gets indexed with (1,s). The indexed value will be multiplied by "tmp" and then placed into the 2D array "chip" at index (i,l).
What part is it that is not solvable for you?
Is it the part of indexing an array?
Do you have problems in multiplying two values?
Don't you know how to use ReplaceArraySubset?
Or can't you increment some loop indices?
Come on, do some programming on your own...
05-13-2012 01:04 AM
Still i have problem
for j=1:chiplen
k=j+rem(randint(1,1,1000)*randint(1,1,1000),(chiplen+1-j));
tmp=scrambrule(i,j);
scrambrule(i,j)=scrambrule(i,k);
scrambrule(i,k)=tmp;
end