We process a higher amount of data

This commit is contained in:
ha7ilm 2017-04-29 23:27:39 +02:00
parent bfd3004106
commit ec38e3be7d
2 changed files with 13 additions and 12 deletions

View file

@ -5,7 +5,7 @@
%pkg install -forge parallel %pkg install -forge parallel
pkg load parallel pkg load parallel
system('cat /dev/urandom | csdr pack_bits_8to1_u8_u8 | csdr psk_modulator_u8_c 2 | csdr gain_ff 0.25 | csdr psk31_interpolate_sine_cc 256 | csdr add_n_zero_samples_at_beginning_f 170 | dd bs=32M count=1 of=/tmp/psk31-raw-data'); system('cat /dev/urandom | csdr pack_bits_8to1_u8_u8 | csdr psk_modulator_u8_c 2 | csdr gain_ff 0.25 | csdr psk31_interpolate_sine_cc 256 | csdr add_n_zero_samples_at_beginning_f 170 | dd iflag=fullblock bs=4M count=1 of=/tmp/psk31-raw-data');
function output=shrun(cmd, type, minsize) function output=shrun(cmd, type, minsize)
SIGTERM=15; SIGTERM=15;
@ -15,11 +15,11 @@ function output=shrun(cmd, type, minsize)
%fclose(pin); %fclose(pin);
do do
sleep(0.3) sleep(0.3)
disp('size(output)'); fwrite(stdout,'.');
%size(output) %size(output)
%output %output
current_output=fread(pout, Inf, type) current_output=fread(pout, Inf, type);
frewind(pout) frewind(pout);
output=[output; current_output]; output=[output; current_output];
until(size(output)(1)>=minsize) until(size(output)(1)>=minsize)
waitpid(pid); waitpid(pid);
@ -30,22 +30,22 @@ end
function variance=run_var(snr, which_ted) function variance=run_var(snr, which_ted)
disp('ran a command') disp('ran a command')
out_vect=shrun(sprintf('cat /tmp/psk31-raw-data | csdr awgn_cc %d | csdr timing_recovery_cc %s 256 --add_q --output_indexes | CSDR_FIXED_BUFSIZE=65536 csdr normalized_timing_variance_u32_f 256 85', snr, which_ted), 'float32', 1); out_vect=shrun(sprintf('cat /tmp/psk31-raw-data | csdr awgn_cc %d --snrshow-no| csdr timing_recovery_cc %s 256 --add_q --output_indexes | CSDR_FIXED_BUFSIZE=131072 csdr normalized_timing_variance_u32_f 256 85', snr, which_ted), 'float32', 1);
disp('run_var output:'); disp('run_var output:');
out_vect' out_vect'
variance=out_vect(1); variance=out_vect(1);
end end
function variances=mkvarplot(which_ted, snrs) function variances=mkvarplot(which_ted, snrs)
%{
fun = @(x) run_var(x, which_ted); fun = @(x) run_var(x, which_ted);
variances=pararrayfun(nproc, fun, snrs); variances=pararrayfun(nproc, fun, snrs);
%} %{
variances=[] variances=[]
for snr=snrs for snr=snrs
snr snr
variances=[variances run_var(snr, which_ted)]; variances=[variances run_var(snr, which_ted)];
end end
%}
end end
function fmtplot(h) function fmtplot(h)
@ -54,11 +54,12 @@ function fmtplot(h)
set(FN,'FontName','times'); set(FN,'FontName','times');
FS = findall(h,'-property','FontSize'); FS = findall(h,'-property','FontSize');
set(FS,'FontSize',18); set(FS,'FontSize',18);
xlabel('Phase offset in number of samples'); xlabel('SNR [dB]');
ylabel('Error value (TED output)'); ylabel('Phase error variance [rad^2]');
end end
snrs_gardner=-30:5:40 snrs_gardner=-70:5:40
%snrs_gardner=[10]
error_values_gardner=mkvarplot('GARDNER',snrs_gardner); error_values_gardner=mkvarplot('GARDNER',snrs_gardner);
%{ %{
snrs_earlylate=0:256 snrs_earlylate=0:256
@ -69,7 +70,7 @@ error_values_earlylate=mkvarplot('EARLYLATE',snrs_earlylate);
h=figure(1); h=figure(1);
semilogy(snrs_gardner, error_values_gardner, 'linewidth', 2); semilogy(snrs_gardner, error_values_gardner, 'linewidth', 2);
title('S-curve for Gardner TED'); title('Variance curve');
fmtplot(h) fmtplot(h)
pause pause

View file

@ -2187,7 +2187,7 @@ float normalized_timing_variance_u32_f(unsigned* input, float* temp, int input_s
ndiff_rad_mean = ndiff_rad_mean*(((float)i)/(i+1))+(ndiff_rad[i]/(i+1)); ndiff_rad_mean = ndiff_rad_mean*(((float)i)/(i+1))+(ndiff_rad[i]/(i+1));
//fprintf(stderr, "input[%d] = %u, sinearest = %u, socorrect = %u, sodiff = %u, ndiff = %f, ndiff_rad[i] = %f, ndiff_rad_mean = %f\n", i, input[i], sinearest, socorrect, sodiff, ndiff, ndiff_rad[i], ndiff_rad_mean); //fprintf(stderr, "input[%d] = %u, sinearest = %u, socorrect = %u, sodiff = %u, ndiff = %f, ndiff_rad[i] = %f, ndiff_rad_mean = %f\n", i, input[i], sinearest, socorrect, sodiff, ndiff, ndiff_rad[i], ndiff_rad_mean);
} }
//fprintf(stderr, "ndiff_rad_mean = %f\n", ndiff_rad_mean); fprintf(stderr, "ndiff_rad_mean = %f\n", ndiff_rad_mean);
float result = 0; float result = 0;
for(int i=0;i<input_size;i++) result+=(powf(ndiff_rad[i]-ndiff_rad_mean,2))/(input_size-1); for(int i=0;i<input_size;i++) result+=(powf(ndiff_rad[i]-ndiff_rad_mean,2))/(input_size-1);