csdr/grc_tests/bpsk31_scurve.m

68 lines
1.6 KiB
Mathematica
Raw Permalink Normal View History

#!/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);
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));
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
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
2017-05-19 20:55:11 +08:00
skips_gardner=0:16:256
2017-04-29 18:28:56 +08:00
error_values_gardner=mkscurve('GARDNER',skips_gardner);
2017-05-19 20:55:11 +08:00
skips_earlylate=0:16:256
2017-04-29 18:28:56 +08:00
error_values_earlylate=mkscurve('EARLYLATE',skips_earlylate);
2017-04-29 17:43:54 +08:00
%graphics_toolkit("gnuplot")
h=figure(1);
2017-05-19 20:55:11 +08:00
plot((skips_gardner-128)/256, -error_values_gardner, 'linewidth', 2);
2017-04-29 18:28:56 +08:00
title('S-curve for Gardner TED');
fmtplot(h)
2017-05-19 20:55:11 +08:00
grid on
2017-04-29 18:28:56 +08:00
pause
2017-04-29 17:43:54 +08:00
2017-05-19 20:55:11 +08:00
plot((skips_earlylate-128)/256, error_values_earlylate, 'linewidth', 2);
2017-04-29 18:28:56 +08:00
title('S-curve for early-late TED');
fmtplot(h)
2017-05-19 20:55:11 +08:00
grid on
pause