
fn = 'C:\Users\radar\Documents\Travel\Antarctica_2011\DDS_ADC direct measurement\DDS_chan3.csv';

fid = fopen(fn,'r');

C = textscan(fid,'%f %f','HeaderLines',15,'Delimiter',',');
tx_signal_time = C{1};
tx_signal = C{2};
clear C;

fclose(fid);

figure(1); clf;
fig_pos = get(1,'Position');
set(1,'Position',[fig_pos(1:2) 827 362]);
plot(tx_signal_time*1e6, tx_signal);
grid on;
xlabel('time (us)');
ylabel('volts (V)');

fs = 1e9/9;
dt = 1/fs;

fn = 'D:\data\chan1\seg36\mcords.rec001.r1-1.20111012115318.0000.dat';
if 0
  [hdr,data] = basic_load_mcords(fn,struct('clk',fs,'first_byte',2^26));

  adc_bits = 14;
  Vpp_scale = 2;
  Vpp_scale = 3.4; % required to make data match up... not right though I think
  for wf = 1:length(data)
    data{wf} = data{wf}(1:end-1,:);
    data{wf} = data{wf} - median(data{wf}(:,1));
    data{wf} = data{wf} ...
      * Vpp_scale/2^adc_bits ...
      * 2^hdr.wfs(wf).bit_shifts/hdr.wfs(wf).presums;
  end
end

wf = 2;
Nt = size(data{wf},1);
time = dt*(0:Nt-1).';
hold on;
plot(time*1e6, data{wf}(:,1), 'r');
hold off;

return;

