From: Josef H on 19 Feb 2010 09:57 Hi, I'm trying to find a bitsequence in a bigger bitstream. The pattern i am looking for is a PRBS of 127 bits. I want to do this with cross correlation and finding a peak, but something is wrong in the way i try to use the bitstream and crosscorrelation; I take the pattern of 127 bits, divide it into 32 bit chuncks, convert to integer. These four integers form a vector which i zeropad to the same length as the stream which also is converted into 32bit integers. These two are cross correlated, both with matlabs 'xcorr' and with my own written code. They both produce the same output which is completely unreliable so i assume i do something wrong. Here is the rough code of what I do; %convert bitstream (array of 1 and 0) into numbers ml1 = bin2dec(dec2hex(ml(1:32))'); ml2 = bin2dec(dec2hex(ml(33:64))'); ml3 = bin2dec(dec2hex(ml(65:96))'); ml4 = bin2dec(dec2hex(ml(97:127))'); %create an array of four elements. ml = [ml4 ml3 ml2 ml1]; %pad with zeros to get same length as bitstream ml = [zeros(1,16) ml]; %plot the spectrum, the input is modified in the same way as 'ml' plot(xcorr(input,ml,'coeff')); Is there any smarter way to do this? One that actually works?
|
Pages: 1 Prev: There are no products to install Next: Shifting my array output |