Added S-curve for Gardner

This commit is contained in:
ha7ilm 2017-04-29 12:28:56 +02:00
parent e426ef65d1
commit a9dc49c8d9
2 changed files with 37 additions and 22 deletions

4
csdr.c
View file

@ -2523,8 +2523,8 @@ int main(int argc, char *argv[])
{ {
if(argc<=2) return badsyntax("need required parameter (algorithm)"); if(argc<=2) return badsyntax("need required parameter (algorithm)");
timing_recovery_algorithm_t algorithm = timing_recovery_get_algorithm_from_string(argv[2]); timing_recovery_algorithm_t algorithm = timing_recovery_get_algorithm_from_string(argv[2]);
if(algorithm == TIMING_RECOVERY_ALGORITHM_DEFAULT) //if(algorithm == TIMING_RECOVERY_ALGORITHM_DEFAULT)
fprintf(stderr,"#timing_recovery_cc: algorithm = %s\n",timing_recovery_get_string_from_algorithm(algorithm)); // fprintf(stderr,"#timing_recovery_cc: algorithm = %s\n",timing_recovery_get_string_from_algorithm(algorithm));
if(argc<=3) return badsyntax("need required parameter (decimation factor)"); if(argc<=3) return badsyntax("need required parameter (decimation factor)");
int decimation; int decimation;
sscanf(argv[3],"%d",&decimation); sscanf(argv[3],"%d",&decimation);

View file

@ -20,31 +20,46 @@ function output=shrunf(cmd)
until(feof(pout)) until(feof(pout))
waitpid(pid); waitpid(pid);
%kill(pid, SIGTERM); %kill(pid, SIGTERM);
fclose(pin);
fclose(pout);
end end
function error_value=run_tr(skip) 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 EARLYLATE 256 --add_q --output_error',skip)); 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); error_value=out_vect(2);
end end
skips=0:256; function error_values=mkscurve(which_ted, skips)
error_values=[] error_values=[]
for skip=skips for skip=skips
error_values=[error_values run_tr(skip)]; error_values=[error_values run_tr(skip, which_ted)];
end
end end
error_values 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);
%graphics_toolkit("gnuplot") %graphics_toolkit("gnuplot")
h=figure(1); h=figure(1);
plot(skips, error_values, 'linewidth', 2);
xlabel('Phase offset in number of samples');
ylabel('Error value (TED output)');
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);
plot(skips_gardner, error_values_gardner, 'linewidth', 2);
title('S-curve for Gardner TED');
fmtplot(h)
pause
plot(skips_earlylate, error_values_earlylate, 'linewidth', 2);
title('S-curve for early-late TED');
fmtplot(h)
pause pause