# symbol synchronization method for SDR in Matlab?

Started by March 16, 2011
```hello, any of you has experience with different methods for symbol
synchronization so you can help me to implement one of them in a receiver
for bpsk modulation?
i've implemented a costas loop for carrier recovery and the code i've found
for symbol synchronization is too heavy and takes too much time. this is
the matlab code:

tnow=del*oversampling+1; tau=0; xs=zeros(1,length(y));           %
initialize variables
tausave=zeros(1,length(y)); tausave(1)=tau; i=0;
mu=0.05;                                    % algorithm stepsize
delta=0.1;                                  % time for derivative
while tnow<length(y)-del*oversampling       % run iteration
i=i+1;
xs(i)=interpsinc(y,tnow+tau,del);           % interpolated value at
tnow+tau
x_deltap=interpsinc(y,tnow+tau+delta,del);  % get value to the right
x_deltam=interpsinc(y,tnow+tau-delta,del);  % get value to the left
dx=x_deltap-x_deltam;                     % calculate numerical
derivative
tau=tau+mu*dx*xs(i);                      % alg update (energy)
tnow=tnow+oversampling; tausave(i)=tau;              % save for plotting
end

pam_rx=xs;                               % Decis&atilde;o de S&iacute;mbolo Recebido

bits_rx=pam_rx>0;                         %Estima&ccedil;&atilde;o dos bits recebidos;

ah, the interpsinc function is:
function y=interposinc(x, t, l, beta)
% interpolate to find a single point using the direct method
%        x = sampled data
%        t = place at which value desired
%        l = one sided length of data to interpolate
%        beta = rolloff factor for SRRC function
%             = 0 is a sinc
if nargin==3, beta=0; end;          % if unspecified, beta is 0
tnow=round(t);                      % create indices tnow=integer part
tau=t-round(t);                     % plus tau=fractional part
s_tau=srrc(l,beta,1,tau);           % interpolating sinc at offset tau
x_tau=conv(x(tnow-l:tnow+l),s_tau); % interpolate the signal
y=x_tau(2*l+1);                     % the new sample

if any of you have an idea of how i can do it without doing so many

```
```On Mar 16, 3:22&#2013266080;pm, "algora" <cgalgora@n_o_s_p_a_m.uclv.edu.cu> wrote:
> hello, any of you has experience with different methods for symbol
> synchronization so you can help me to implement one of them in a receiver
> for bpsk modulation?
> i've implemented a costas loop for carrier recovery and the code i've found
> for symbol synchronization is too heavy and takes too much time. this is
> the matlab code:
>
> tnow=del*oversampling+1; tau=0; xs=zeros(1,length(y)); &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; %
> initialize variables
> tausave=zeros(1,length(y)); tausave(1)=tau; i=0;
> mu=0.05; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080;% algorithm stepsize
> delta=0.1; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080;% time for derivative
> while tnow<length(y)-del*oversampling &#2013266080; &#2013266080; &#2013266080; % run iteration
> &#2013266080; i=i+1;
> &#2013266080; xs(i)=interpsinc(y,tnow+tau,del); &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; % interpolated value at
> tnow+tau
> &#2013266080; x_deltap=interpsinc(y,tnow+tau+delta,del); &#2013266080;% get value to the right
> &#2013266080; x_deltam=interpsinc(y,tnow+tau-delta,del); &#2013266080;% get value to the left
> &#2013266080; dx=x_deltap-x_deltam; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; % calculate numerical
> derivative &#2013266080;
> &#2013266080; tau=tau+mu*dx*xs(i); &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080;% alg update (energy)
> &#2013266080; tnow=tnow+oversampling; tausave(i)=tau; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080;% save for plotting
> end
>
> pam_rx=xs; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; % Decis&#2013265923;o de S&#2013265933;mbolo Recebido
>
> bits_rx=pam_rx>0; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; %Estima&#2013265927;&#2013265923;o dos bits recebidos;
>
> ah, the interpsinc function is:
> function y=interposinc(x, t, l, beta)
> % interpolate to find a single point using the direct method
> % &#2013266080; &#2013266080; &#2013266080; &#2013266080;x = sampled data
> % &#2013266080; &#2013266080; &#2013266080; &#2013266080;t = place at which value desired
> % &#2013266080; &#2013266080; &#2013266080; &#2013266080;l = one sided length of data to interpolate
> % &#2013266080; &#2013266080; &#2013266080; &#2013266080;beta = rolloff factor for SRRC function
> % &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; = 0 is a sinc
> if nargin==3, beta=0; end; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080;% if unspecified, beta is 0
> tnow=round(t); &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080;% create indices tnow=integer part
> tau=t-round(t); &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; % plus tau=fractional part
> s_tau=srrc(l,beta,1,tau); &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; % interpolating sinc at offset tau
> x_tau=conv(x(tnow-l:tnow+l),s_tau); % interpolate the signal
> y=x_tau(2*l+1); &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; % the new sample
>
> if any of you have an idea of how i can do it without doing so many