Previously the pattern was repeating after every 2 occasions (+1 -1)(+1 -1). So, you used rem function with respect to 2. Now the pattern has to repeat after every 4 occasions (+1 +1 -1 -1)(+1 +1 -1 -1). So, let us use rem function with respect to 4. I think the changes as done below will suffice your requirement.
for m = 0:Npulses
if rem(m,4) == 0 | rem(m,4) == 1
Tx1 = exp(1j*pi*gamma*(t-m*PRI).^2);
W=ones(size(t));
W(t<m*PRI)=0;
W(t>(m*PRI+tau))=0;
s1 = Tx1.*W+s1;
else
Tx2 = -exp(1j*pi*gamma*(t-m*PRI).^2);
W=ones(size(t));
W(t<m*PRI)=0;
W(t>(m*PRI+tau))=0;
s1 = Tx2.*W+s1;
end
end
Best Answer