% plot_rtna         - Plot real-time network analyzer data

function [freq mag phase] = plot_rtna(data)

% Find the gap
u=512;

freq  = [data.freq(1:u) NaN data.freq(u+1:end)] - data.wrf/2/pi;
mag   = [data.mag(1:u) NaN data.mag(u+1:end)];
phase = [data.phase(1:u) NaN data.phase(u+1:end)];

clf
subplot(211); set(gca, 'fontsize', 12);
plot(freq/1e3, mag, '-', 'linewidth', 2);
xlabel('Frequency offset (kHz)');
ylabel('Gain (dB)');
grid;
subplot(212); set(gca, 'fontsize', 12);
plot(freq/1e3, phase, 'r', 'linewidth', 2);
xlabel('Frequency offset (kHz)');
ylabel('Phase (degrees)');
grid;

if (nargout == 0)
  clear freq mag phase
end
