Main Content

Generate Arbitrary Waveforms Using Quick-Control Function Generator

This example shows how to use Quick-Control Function Generator to generate an arbitrary waveform. To generate a standard waveform, see Generate Standard Waveforms Using Quick-Control Function Generator. Quick-Control Function Generator works with any function generator using an IVI-C driver as long as the instrument and the driver support the functionality. You can follow the basic steps using your particular function generator. This example uses Keysight® VISA, but you can use any vendor's implementation of VISA.

In this example, an electronic design engineer wants to generate a complex waveform with MATLAB®, then download them into the function/arbitrary waveform generator and output them one after the other, and then finally remove the downloaded waveforms afterward. In this example we are using the GPIB interface.

  1. Ensure all necessary software is installed. See Quick-Control Function Generator Requirements for the list.

  2. Create an instance of the function generator.

    % Instantiate an instance of the fgen.
    myFGen = fgen();
  3. Set the resource.

    myFGen.Resource = 'GPIB0::10::INSTR';
  4. Connect to the function generator.

    connect(myFGen);
  5. Specify the channel name from which the function generator produces the waveform.

    selectChannel(myFGen, '1');
  6. Configure the function generator.

    You can configure any of the instrument’s properties that are settable. Configure the waveform to be a continuous arbitrary wave.

    % Set the type of waveform to an arbitrary wave.
    myFGen.Waveform = 'arb';
    
    % Set the output mode to continuous. 
    myFGen.Mode = 'continuous';
    
  7. Communicate with the instrument.

    In this example, create the waveform, then download it to the function generator using the downloadWaveform function. Then enable the output using the enableOutput function, and then remove the waveform using the removeWaveform function.

    % Create the waveform. 
    w1 = 1:0.001:2; 
    
    % Download the waveform to the function generator. 
    h1 = downloadWaveform (myFGen, w1);
    
    % Enable the output. 
    enableOutput(myFGen);
    

    When you are done, remove the waveforms.

    % Remove the waveform. 
    removeWaveform(myFGen);
    
  8. After communicating with the instrument, close the session and remove it from the workspace.

    disconnect(myFGen);
    clear myFgen;

For a list of supported functions for use with Quick-Control Function Generator, see Quick-Control Function Generator Functions.

Related Topics