📄 iq_demod.m
字号:
function R_received =IQ_demod(combined,I_PN_state2,Q_PN_state2)
%IQ demodulator
%It carries out the in phase and quadrature phase demodulation of the received data signal the in phase Stream,which contains the real amplitude component of each signal element in the multipaht signal and Quadrature phase Stream.which contains the imaginary amplitude component of each signal element in the multipath signal I and Q pilot PN sequence generator are both 15 stage shift register
%assign the stage values of I pilot PN Sequence generator shift register
Ishift2=I_PN_state2;
%assign the stage values of Q pilot PN Sequence generator shift register
Qshift2=Q_PN_state2;
%make two arrays to hold the I and Q bit streams of data each stream hold a total of 12288 bits
outI2=zeros([1,12288]);
outQ2=zeros([1,12288]);
%seperate the I and Q streams
for i=1:12288
%I=1 when I>0
if real(combined(i))>=0
outI2(i)=1;
end
%I=0 when I<0
if real(combined(i))<0
outI2(i)=0;
end
%Q=1 when Q>0
if imag(combined(i))>=0
outQ2(i)=(1*sqrt(-1));
outQ2(i)=imag(outQ2(i));
end
%Q=0 when Q<0
if imag(combined(i))<0
outQ2(i)=(0*sqrt(-1));
outQ2(i)=imag(outQ2(i));
end
end
for i=1:12288
outI2(i)=mod((outI2(i)+Ishift2(15)),2);
outQ2(i)=mod((outQ2(i)+Qshift2(15)),2);
%The I and Q pilot PN sequence generating polynomials
%I=x^15+x^13+x^9+x^8+x^7+x^5+1
%Q=x^15+x^12+x^11+x^10+x^6+x^5+x^4+x^3+1
%We calculate The Q LFSR feedback vaule
Ifeed2=mod((Ishift2(15)+Ishift2(13)+Ishift2(9)+Ishift2(8)+Ishift2(7)+Ishift2(5)),2);
%then we do it for I
Qfeed2=mod((Qshift2(15)+Qshift2(12)+Qshift2(11)+Qshift2(10)+Qshift2(6)+Qshift2(5)+Qshift2(4)+Qshift2(3)),2);
%shifting
Ishift2(2:15)=Ishift2(1:14);
Qshift2(2:15)=Qshift2(1:14);
%we then perform shifting for the two LFSRS
Ishift2(1)=Ifeed2;
Qshift2(1)=Qfeed2;
end
IQout= [outI2;outQ2];
R_received=IQout(:)';
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -