📄 baseband2symbols1.asv
字号:
%This function generates the symbols after matching input signal
%with the RRC filter and then detecting the symbols
%Input Parameters:-
%Sig_I : Demodulated Inphase Signal
%Sig_Q : Demodulated Quadrature Signal
%RRC_Filter_Coeff: Coefficients of the RRC filter
%Zi_R_RRC_I: Initial Conditions for the Inphase RRC Filter
%Zi_R_RRC_Q: Initial Conditions for the Quadrature RRC Filter
%InitialDelayReceivedSignal: Initial Delay to sample received signal
%Output Parameters:-
%SymbolsRecovered: Symbols Detected
%Zf_R_RRC_I: Final Conditions for the Inphase RRC Filter
%Zf_R_RRC_Q: Final Conditions for the Quadrature RRC Filter
function [SymbolsRecovered, Zf_R_RRC_I, Zf_R_RRC_Q] = BaseBandToSymbols1(Sig_I, Sig_Q, RRC_Filter_Coeff, Zi_R_RRC_I, Zi_R_RRC_Q, InitialDelayReceivedSignal)
%Paramters Initialization
Parameter;
Initialconstellation;
SymbolsRecovered = [];
%%%%%%%%%%%%%%%%%
%RRC filtering (Matched Filtering)
[Sig_Inphase_Recovered, Zf_R_RRC_I] = filter(RRC_Filter_Coeff, 1, Sig_I, Zi_R_RRC_I);
[Sig_Quad_Recovered, Zf_R_RRC_Q] = filter(RRC_Filter_Coeff, 1, Sig_Q, Zi_R_RRC_Q);
Sig_Inphase_Recovered = Sig_Inphase_Recovered(1+InitialDelayReceivedSignal:length(Sig_Inphase_Recovered));
Sig_Quad_Recovered = Sig_Quad_Recovered(1+InitialDelayReceivedSignal:length(Sig_Quad_Recovered));
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SymbolPos = [1:length(Sig_Inphase_Recovered)/SamplesPerSymbol];
%Sampling the signal at the multiples of Symbol time
Sig_Inphase_Recovered = Sig_Inphase_Recovered(ceil((SymbolPos-1) * SamplesPerSymbol + 1));
Sig_Quad_Recovered = Sig_Quad_Recovered(ceil((SymbolPos-1) * SamplesPerSymbol + 1));
Sig = Sig_Inphase_Recovered + Sig_Quad_Recovered*j;
AmpSig = abs(Sig);
AngleSig = angle(Sig);
SignAngleSig = AngleSig >= 0;
SignAngleSig = double(SignAngleSig);
SignAngleSig(find(SignAngleSig==0))=-1;
%estimate the place to which the symbol belongs and generate Symbols
for iSymb=1:length(Sig_Inphase_Recovered)
CurAmp=AmpSig(iSymb);
[MinAmp,MinAmpPlace]=min(abs(Amp-CurAmp));
CurAmp=Amp(MinAmpPlace);
if M_ary==16
if MinAmpPlace==1
Distance=2*pi/Numsig(1);
CurAngle=fix(AngleSig(iSymb)/Distance)*Distance+SignAngleSig(iSymb)*Distance/2;
CurAngle=round(CurAngle/(Distance/2));
CurAngle=CurAngle*Phs(1);
else
Distance=2*pi/Numsig(2);
CurAngle=fix(AngleSig(iSymb)/Distance)*Distance+SignAngleSig(iSymb)*Distance/2;
CurAngle=round(CurAngle/(Distance/2));
CurAngle=CurAngle*Phs(2);
end
else
if MinAmpPlace==1
Distance=2*pi/Numsig(1);
CurAngle=fix(AngleSig(iSymb)/Distance)*Distance+SignAngleSig(iSymb)*Distance/2;
CurAngle=round(CurAngle/(Distance/2));
CurAngle=CurAngle*Phs(1);
elseif MinAmpPlace==2
Distance=2*pi/Numsig(2);
CurAngle=fix(AngleSig(iSymb)/Distance)*Distance+SignAngleSig(iSymb)*Distance/2;
CurAngle=round(CurAngle/(Distance/2));
CurAngle=CurAngle*Phs(2);
else
Distance=2*pi/Numsig(3);
adjust=SignAngleSig(iSymb)*Distance/2;
CurAngle=fix((AngleSig(iSymb)+adjust)/Distance)*Distance;
CurAngle=round(CurAngle/Distance);
CurAngle=CurAngle*Phs(3);
end
end
CurSymbol=CurAmp*cos(CurAngle)+CurAmp*sin(CurAngle)*j;
SymbolsRecovered = [SymbolsRecovered, CurSymbol];
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -