Help Icon
Search Results for

    Show / Hide Table of Contents

    Add Reference in Octave

    Note

    We focused some issues when using Octave's 'Clear' command (https://octave.sourceforge.io/octave/function/clear.html) in combination with COM. Using COM is not recommended for new developments. We recommend using the SCPI interface. Therefore use the 'Clear' command with deliberation because it may lead to unexpected crashes.

    To add the Bode 100 reference in your Octave project you simply have to use the following code:

    %NOTE! Package required for COM support
    pkg load windows; 
    
    automationInterface = actxserver('OmicronLab.VectorNetworkAnalysis.AutomationInterface');
    bode = automationInterface.Connect();
    
    %Constants 
    points = 201;
    
    %NOTE! In Octave it is NOT possible to set Enums as their Name. We have to set them as numbers.
    sweepMode_Linear = 0;
    %NOTE! Custom Receiver Bandwidth values are in Milli Hz. -> Since we define a constat here this value has to be in Milli Hz [mHz]
    receiverBandwidth_kHz1 = 1000000;
    magnitudeUnit_dB = 0;
    angleUnit_Degree = 1;
    
    s21 = bode.Transmission.CreateS21Measurement();
    
    s21.ConfigureSweep(10,40000000, points, sweepMode_Linear);
    s21.ReceiverBandwidth = receiverBandwidth_kHz1;
    state = s21.ExecuteMeasurement();
    
    resultFrequency = zeros(1,points);
    resultMagnitude = zeros(1,points);
    resultPhase = zeros(1,points);
    for j = 1:points
      resultFrequency(j) = s21.Results.MeasurementFrequencyAt(j - 1);
      resultMagnitude(j) = s21.Results.MagnitudeAt(j - 1, magnitudeUnit_dB);
      resultPhase(j) = s21.Results.PhaseAt(j - 1, angleUnit_Degree);
    end 
    
    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);
    
    Important

    Using Octave to access the Bode Automation Interface will only wirk with GNU Octave version 7.1.0 or higher. There existed a bug that would prevent the COM component from being initialized. The error occured due to changes made in how the COM wrappers work in .NET 6. This bug was fixed with the release of version 7.1.0.

    In this article
    Back to top Generated by DocFX