[go: up one dir, main page]

Menu

[73c35b]: / init / COR_check.m  Maximize  Restore  History

Download this file

47 lines (41 with data), 1.6 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
% COR_check.m: checks that the lag values are exact multiples of p_dtau and ADC interval
% GUISDAP v.1.60 96-05-27 Copyright Asko Huuskonen and Markku Lehtinen
%
% Execution is stopped if a mismatch is found
% Input parameters:
% p_dtau: basic time unit (global)
% lags: Lag values in p_dtau units
% adcint: sampling interval
% bitsep: bit separation in alternating code experiments (optional)
% function COR_check(lags,adcint,bitsep);
function COR_check(lags,adcint,bitsep)
global p_dtau
err=0; laglim=10000*eps;
% Check if lag values are exact multiples of p_dtau
ind=find(abs(lags-round(lags))>laglim);
if length(ind)>0
fprintf('Error: All lag values are not exact multiples of p_dtau of %5.2f us\n',p_dtau)
for lag=lags
fprintf('Lag %4.0f divided by p_dtau is %5.1f\n',lag*p_dtau,lag);end
err=1;
end
% Check if lag values are exact multiples of adcint
ind=find(abs(lags-round(lags/adcint)*adcint)>laglim);
if length(ind)>0,
fprintf('Error: All lag values are not exact multiples of adcint of %5.1f us\n',adcint)
for lag=lags;fprintf('Lag %4.0f divided by adcint is %5.1f\n',lag,lag/adcint);end
err=1;
end
if nargin==3,
% Check if lag values are exact multiples of bitsep
ind=find(abs(lags-round(lags/bitsep)*bitsep)>laglim);
if length(ind)>0,
fprintf('Error: All lag values are not exact multiples of bitsep of %5.2f us\n',bitsep)
for lag=lags;fprintf('Lag %4.0f divided by bitsep is %5.1f\n',lag,lag/bitsep);end
err=1;
end
end
if err,
fprintf(' Check parameters, stopping\n')
error(' Error found by COR_check'),
end