Effacer les filtres
Effacer les filtres

decision device in BASK receiver

2 vues (au cours des 30 derniers jours)
Salma
Salma le 20 Avr 2011
I'm designing decision device in BASK receiver and i have total no. of symbols ns=3000 and divided into total number of bits (tnb)=30 and each bit contains (nsb=100) samples.. i want to make nested for loops that add each 100 sample in each bit and divide it by the total no. of samples (nsb) to get average, if the sum greater than 0.5 then the output is 1 else 0 !!! i made the following code but it's wrong
for w=1:nsb:ns
summ=0;
for g=1:nsb
summ= (summ+fds(g))/nsb
if summ <= 0.5
bitout=0;
else
bitout=1;
end
end
end
where fds is the output from the transmitter after the envelope detector
please could anyone help me with this code?? thanks,

Réponse acceptée

Walter Roberson
Walter Roberson le 20 Avr 2011
I suspect that at the very least you want to move your "if" to after the "end" of the "for g". However, I have to been able to tell from your description what you are trying to do. For example, why calculate all those bitout values only to throw them away the next time you go through the loop?
  3 commentaires
Walter Roberson
Walter Roberson le 20 Avr 2011
for g = w:w+nsb-1
Salma
Salma le 21 Avr 2011
thanks it works perfectly :)

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by