% ------------------------------------------------------------
% MATLAB example on how to import and plot a data file obtained
% with a HP4194A Impedance/Gain-phase Anaylzer and Agilent VEE.
% 
% The format of the data in the file with the measurement
% should be: frequency;gain;phase line by line.
% In this example the data is plotted as a Bode plot - see code.
% ------------------------------------------------------------

close all;
clear all;
clc;

data = importdata('HP4194A_Measurement.txt'); %<!-- Change to your filename
f = data(:,1);   %<!-- Frequency [Hz]
A = data(:,2);   %<!-- Gain [dB] or impedance [Ohm]
B = data(:,3);   %<!-- Phase [degrees]

figure(1);

%--- Impedance or Magnitude vs Frequency ---%
subplot(2,1,1);
semilogx(f, A, 'y', 'LineWidth',2); %<!-- Change to loglog if not in dB
grid;
ylabel('Magnitude [dB] / Impedance [\Omega]');
xlabel('Frequency_{log} [Hz]');

%--- Phase vs Frequency ---%
subplot(2,1,2);
semilogx(f, B, 'b', 'LineWidth',2);
grid;
ylabel('Phase [degrees]');
xlabel('Frequency_{log} [Hz]');

% [EOF]