cp0804_corrsyn.m

来自「uwb无线电基础代码」· M 代码 · 共 30 行

M
30
字号
%
% Function 8.15: "cp0804_corrsyn"
%
% Implements the correlation an input vector (signal)
% with a reference vector (template)
% 'fc' represents the sampling frequency
% 
% The function returns the output of the correlator (C)
%
% Programmed by Guerino Giancola
%

function [C] = cp0804_corrsyn(signal,template,fc)

% ----------------------
% Step One - Correlation
% ----------------------

dt = 1 / fc;

for s = 1 : length(signal)
    
    stmp = cp0804_signalshift(template,fc,s*dt);
    % shifted templated waveform
    
    C(s) = sum(signal.*stmp);
    % value of the correlation
    
end % for 1 : length(signal)

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?