Add Reference in MatLab
To add the Bode 100 reference in your MatLab project you simply have to use the following code:
automationInterface = actxserver('OmicronLab.VectorNetworkAnalysis.AutomationInterface');
bode = automationInterface.Connect();
s21 = bode.Transmission.CreateS21Measurement();
s21.ConfigureSweep(10,40000000, 201, 'SweepMode_Linear');
s21.ReceiverBandwidth = 'ReceiverBandwidth_kHz1';
state = s21.ExecuteMeasurement();
resultFrequency = s21.Results.MeasurementFrequencies;
resultMagnitude = s21.Results.Magnitude('MagnitudeUnit_dB');
resultPhase = s21.Results.Phase('AngleUnit_Degree');
figure
subplot(2,1,1)
plot(resultFrequency,resultMagnitude);
title('Gain')
xlabel('Frequency')
ylabel('Magnitude in dB')
subplot(2,1,2)
plot(resultFrequency, resultPhase);
xlabel('Frequency')
ylabel('Phase in degree')
% shut down
bode.ShutDown();
release(automationInterface);