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.
Ensure all necessary software is installed. See Quick-Control Function Generator Requirements for the list.
Create an instance of the function generator.
% Instantiate an instance of the fgen. myFGen = fgen();
Set the resource.
myFGen.Resource = 'GPIB0::10::INSTR';
Connect to the function generator.
Specify the channel name from which the function generator produces the waveform.
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';
Communicate with the instrument.
In this example, create the waveform, then download it to the function generator using
downloadWaveform function. Then enable the output using the
enableOutput function, and then remove the waveform using the
% 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);
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.