1% cohpsk_demod_plot.m 2% David Rowe May 2015 3% 4% Plot Octave outputs from cohpsk_demod, c2dec, to visualise whats going on 5% when errors hit the system 6 7#{ 8 $ ./cohpsk_get_test_bits - 5600 | ./cohpsk_mod - - | ./cohpsk_ch - - -40 | ./cohpsk_demod - - -o cohpsk_demod.txt | ./cohpsk_put_test_bits - 9 octave> cohpsk_demod_plot("../build_linux/src/cohpsk_demod.txt") 10#} 11 12function cohpsk_demod_plot(fn) 13 Nc=7; Nd=2; Ns=6; 14 15 load(fn); 16 17 Ncf = 100; % number of codec frames to plot 18 Nmf = Ncf/2; % number of modem frames to plot 19 Nms = Nmf*Ns; % number of modem symbols to plot 20 21 figure(1) 22 clf; 23 24 % plot combined signals to show diversity gains 25 26 combined = rx_symb_log_c(:,1:Nc); 27 for d=2:Nd 28 combined += rx_symb_log_c(:, (d-1)*Nc+1:d*Nc); 29 end 30 plot(combined*exp(j*pi/4)/sqrt(Nd),'+') 31 title('Scatter'); 32 axis([-2 2 -2 2]) 33 34 figure(2) 35 clf; 36 subplot(211) 37 plot(rx_phi_log_c(1:Nms,:)) 38 title('phase') 39 axis([1 Nms -pi pi]) 40 subplot(212) 41 plot(rx_amp_log_c(1:Nms,:)) 42 title('amplitude') 43 axis([1 Nms 0 1]) 44 45 figure(3) 46 subplot(211) 47 plot(rx_timing_log_c) 48 title('rx timing'); 49 subplot(212) 50 stem(ratio_log_c) 51 title('Sync ratio'); 52 53 figure(4) 54 plot(f_est_log_c - 1500) 55 title('freq offset est'); 56 axis([1 Nmf -50 50]) 57 58 figure(5) 59 y = 1:Nms; 60 x = 1:Nc*Nd; 61 z = 20*log10(rx_amp_log_c(1:Nms,:)); 62 mesh(x,y,z); 63 grid 64 title('Channel Amplitude dB'); 65 a = min(min(z)); 66 b = max(max(z)); 67 axis([1 Nc*Nd 1 Nms a b]) 68end 69 70