2017-04-28 20:20:14 +08:00
|
|
|
#!/usr/bin/octave
|
|
|
|
|
|
|
|
%{
|
|
|
|
function [output]=fgc(path, type)
|
|
|
|
if(type(1)=='f')
|
|
|
|
elseif(type(1)=='c')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
%}
|
|
|
|
|
|
|
|
function output=shrunf(cmd)
|
|
|
|
SIGTERM=15;
|
|
|
|
output=[];
|
|
|
|
[pin, pout, pid]=popen2('bash',{'-c', cmd});
|
|
|
|
%fclose(pin);
|
|
|
|
sleep(0.1)
|
|
|
|
do
|
|
|
|
current_output=fread(pout, Inf, 'float32');
|
|
|
|
output=[output; current_output];
|
|
|
|
until(feof(pout))
|
|
|
|
waitpid(pid);
|
|
|
|
%kill(pid, SIGTERM);
|
2017-04-29 18:28:56 +08:00
|
|
|
fclose(pin);
|
|
|
|
fclose(pout);
|
2017-04-28 20:20:14 +08:00
|
|
|
end
|
|
|
|
|
2017-04-29 18:28:56 +08:00
|
|
|
function error_value=run_tr(skip, which_ted)
|
|
|
|
out_vect=shrunf(sprintf('dd bs=8 skip=%d if=bpsk31_baseband_sample_complex_8000_sps_010101.raw | csdr timing_recovery_cc %s 256 --add_q --output_error', skip, which_ted));
|
2017-04-28 20:20:14 +08:00
|
|
|
error_value=out_vect(2);
|
|
|
|
end
|
|
|
|
|
2017-04-29 18:28:56 +08:00
|
|
|
function error_values=mkscurve(which_ted, skips)
|
|
|
|
error_values=[]
|
|
|
|
for skip=skips
|
|
|
|
error_values=[error_values run_tr(skip, which_ted)];
|
|
|
|
end
|
2017-04-28 20:20:14 +08:00
|
|
|
end
|
|
|
|
|
2017-04-29 18:28:56 +08:00
|
|
|
function fmtplot(h)
|
|
|
|
FN = findall(h,'-property','FontName');
|
|
|
|
set(FN,'FontName','/usr/share/fonts/truetype/ttf-dejavu/DejaVuSerifCondensed.ttf');
|
|
|
|
set(FN,'FontName','times');
|
|
|
|
FS = findall(h,'-property','FontSize');
|
|
|
|
set(FS,'FontSize',18);
|
|
|
|
xlabel('Phase offset in number of samples');
|
|
|
|
ylabel('Error value (TED output)');
|
|
|
|
end
|
|
|
|
|
|
|
|
skips_gardner=0:256
|
|
|
|
error_values_gardner=mkscurve('GARDNER',skips_gardner);
|
|
|
|
skips_earlylate=0:256
|
|
|
|
error_values_earlylate=mkscurve('EARLYLATE',skips_earlylate);
|
2017-04-29 17:43:54 +08:00
|
|
|
|
|
|
|
%graphics_toolkit("gnuplot")
|
|
|
|
h=figure(1);
|
|
|
|
|
2017-04-29 18:28:56 +08:00
|
|
|
plot(skips_gardner, error_values_gardner, 'linewidth', 2);
|
|
|
|
title('S-curve for Gardner TED');
|
|
|
|
fmtplot(h)
|
|
|
|
pause
|
2017-04-29 17:43:54 +08:00
|
|
|
|
2017-04-29 18:28:56 +08:00
|
|
|
plot(skips_earlylate, error_values_earlylate, 'linewidth', 2);
|
|
|
|
title('S-curve for early-late TED');
|
|
|
|
fmtplot(h)
|
2017-04-28 20:20:14 +08:00
|
|
|
pause
|