Actually this plot now looks OK
This commit is contained in:
parent
2a4e2ce190
commit
d7d36a70a8
1 changed files with 26 additions and 6 deletions
|
@ -5,7 +5,26 @@
|
|||
%pkg install -forge 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 iflag=fullblock bs=8M count=1 of=/tmp/psk31-raw-data');
|
||||
function y=inarg(x)
|
||||
for i=1:length(argv())
|
||||
if strcmp(argv(){i},x)
|
||||
y=1;
|
||||
return
|
||||
end
|
||||
end
|
||||
y=0;
|
||||
end
|
||||
|
||||
if !inarg('--nogen')
|
||||
fwrite(stdout, "===========================================\nGenerating baseband signal from random data\n===========================================\n");
|
||||
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 | pv -ps 2g | dd iflag=fullblock bs=128M count=16 of=/tmp/psk31-raw-data');
|
||||
fwrite(stdout, "===========================================\nGenerating Gaussian white noise for agwn_cc\n===========================================\n");
|
||||
system('csdr gaussian_noise_c | pv -ps 256m | dd of=/tmp/psk31-gaussian-noise iflag=fullblock bs=256M count=1');
|
||||
end
|
||||
if inarg('--onlygen')
|
||||
exit(0)
|
||||
end
|
||||
fwrite(stdout, "===========================================\nCalculating variance graph data \n===========================================\n");
|
||||
|
||||
function output=shrun(cmd, type, minsize)
|
||||
SIGTERM=15;
|
||||
|
@ -30,10 +49,10 @@ end
|
|||
|
||||
function variance=run_var(snr, which_ted)
|
||||
disp('ran a command')
|
||||
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=2048 csdr normalized_timing_variance_u32_f 256 85', snr, which_ted), 'float32', 2);
|
||||
out_vect=shrun(sprintf('cat /tmp/psk31-raw-data | csdr awgn_cc %d --awgnfile /tmp/psk31-gaussian-noise | csdr timing_recovery_cc %s 256 --add_q --output_indexes | CSDR_FIXED_BUFSIZE=1048576 csdr normalized_timing_variance_u32_f 256 85', snr, which_ted), 'float32', 1);
|
||||
disp('run_var output:');
|
||||
out_vect'
|
||||
variance=out_vect(2);
|
||||
variance=out_vect(1);
|
||||
end
|
||||
|
||||
function variances=mkvarplot(which_ted, snrs)
|
||||
|
@ -60,7 +79,7 @@ end
|
|||
|
||||
snrs=-5:5:30
|
||||
%snrs=[10]
|
||||
error_values_gardner=mkvarplot('EARLYLATE',snrs);
|
||||
error_values_gardner=mkvarplot('GARDNER',snrs);
|
||||
%{
|
||||
snrs_earlylate=0:256
|
||||
error_values_earlylate=mkvarplot('EARLYLATE',snrs_earlylate);
|
||||
|
@ -69,7 +88,6 @@ error_values_earlylate=mkvarplot('EARLYLATE',snrs_earlylate);
|
|||
%graphics_toolkit("gnuplot")
|
||||
h=figure(1);
|
||||
|
||||
|
||||
ebn0=snrs-13.26-10*log10(1/256.)
|
||||
%13.56 dB is the difference between the real (measured) SNR and the number input to awgn_cc.
|
||||
%This is because agwn_cc assumes a signal with 0dB power at te input, while our BPSK31 baseband signal is of -13.26 dB.
|
||||
|
@ -86,4 +104,6 @@ fmtplot(h)
|
|||
pause
|
||||
%}
|
||||
|
||||
system('rm /tmp/psk31-raw-data');
|
||||
if !inarg('--nogen')
|
||||
system('rm /tmp/psk31-raw-data /tmp/psk31-gaussian-noise');
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue