I have to generate a specific type of Pulse position modulation for which i am generating 100 random bits and have to check every two adjacent bits and generate a waveform accordingly.
lets say the generated bits are 11001001
first I need to check the first two bits which are 11 and then the next two bits which are 00 and the following two bits are 10 and the last to bits 01 I have written the following code to check the bits
clear all;N=10000;Nbit=100;t=0:.001:6.4;% Generate Binary signalwb=round(rand(1,Nbit));% wb=wb';y=size(wb);i=1:Nbitj=i+1;if wb(i) ==0 & wb(j)==0y(i)=0;elseif wb(i) ==0 & wb(j)==1y(i)=1;elseif wb(i) ==1 & wb(j)==0y(i)=0;elsey(i)=0;end
the output always gives 0.
Would really appreciate if someone could help me with this