| Contents | Index |
| On this page… |
|---|
Quick-Control Oscilloscope Prerequisites Example: Reading Waveforms Using the Quick-Control Oscilloscope |
You can use the Quick-Control Oscilloscope for any oscilloscope that uses an underlying IVI-C or IVI-COM driver. However, you do not have to directly deal with the underlying driver. You can also use it for Tektronix oscilloscopes. This oscilloscope object is an easy to use.
This documentation example uses a specific instrument, an Agilent MSO6104 oscilloscope. This feature works with any IVI-C or IVI-COM class oscilloscope. You can follow the basic steps, using your particular instrument.
To use the Quick-Control Oscilloscope for an IVI-C or IVI-COM scope, you must have the following software installed.
Windows 32-bit (IVI-C and IVI-COM) or Windows 64-bit (IVI-C only) platforms
VISA shared components (IVI-C only)
IVI shared components (IVI-COM only)
VISA (IVI-C and IVI-COM)
Note, the following example uses Agilent VISA, but you can use any version of VISA.
National Instruments IVI compliance package NICP 4.1 (IVI-C only)
Your instrument's device-specific driver (IVI-C and IVI-COM)
You can use instrhwinfo to confirm that the required software is installed.
% Check that the software is properly installed.
instrhwinfo('ivi')Note that the following example is for an IVI-C device and therefore uses the IVI-C prerequisites.
To use the Quick-Control Oscilloscope for a Tektronix scope, there is no specific software required. You can use it on any supported platform.
You can use the Quick-Control Oscilloscope for a Tektronix scope with or without VISA. VISA is not required but it can be used.
This example shows the general workflow to use for the Quick-Control Oscilloscope. This example uses a specific instrument, an Agilent MSO6104 oscilloscope. This feature works with any oscilloscope using an IVI-C or IVI-COM driver. You can follow the basic steps using your particular scope. For use with a Tektronix scope, see the example in the next section.
Ensure all necessary software is installed. See Quick-Control Oscilloscope Prerequisites for the list.
Ensure that your instrument is recognized by the VISA utility. In this case, open Agilent Connectivity Expert and make sure it recognizes the oscilloscope.
Create an instance of the oscilloscope.
% Instantiate an instance of the scope. myScope = oscilloscope()
Discover available resources. A resource string is an identifier to the instrument. You must set it before connecting to the instrument.
% Find resources. availableResources = getResources(myScope)
This returns a resource string or an array of resource strings.
availableResources = TCPIP0::a-m6104a-004598.dhcp.mathworks.com::inst0::INSTR
Connect to the scope.
If multiple resources are available, use the VISA utility to verify the correct resource and set it.
set(myScope, 'Resource', 'TCPIP0::a-m6104a-004598::inst0::INSTR');
% Connect to the scope. connect(myScope);
Configure the oscilloscope.
You can configure any of the scope's properties that are able to be set. In this example enable channel 1 and configure various acquisition settings as shown.
% Automatically configure the scope based on the input signal.
autoSetup(myScope);
% Set the acquistion time to 0.01 second.
set(myScope, 'AcquistionTime', 0.01);
% Set the acquistion to collect 2000 data points.
set(myScope, 'WaveformLength', 2000);
% Set the trigger mode to normal.
set(myScope, 'TriggerMode', 'normal');
% Set the trigger level to 0.1 volt.
set(myScope, 'TriggerLevel', 0.1);
% Enable channel 1.
enableChannel(myScope, 'Channel1');
% Set the vertical coupling to AC.
setVerticalCoupling (myScope, 'Channel1', 'AC');
% Set the vertical range to 5.0.
setVerticalRange (myScope, 'Channel1', 5.0);
Communicate with the instrument. For example, read a waveform.
In this example, the getWaveform function returns the waveform that was acquired using the front panel of the scope. The function can also initiate an acquisition on the enabled channel and then return the waveform after the acquisition. For examples on all the use cases for this function, see getWaveform.
% Acquire the waveform.
waveformArray = getWaveform(myScope);
% Plot the waveform and assign labels for the plot.
plot(waveformArray);
xlabel('Samples');
ylabel('Voltage');After configuring the instrument and retrieving its data, close the session and remove it from the workspace.
disconnect(myScope); clear myScope;
Reading a waveform with a Tektronix scope using Quick-Control Oscilloscope is basically the same workflow as described in the previous example using an Agilent scope with VISA. But the resource and driver information is different.
If you use the getResources function, instead of getting a VISA resource string as shown in step 4 of the previous example, you will get the interface resource of the Tektronix scope. For example:
% Find resources. availableResources = getResources(myScope)
This returns the interface resource information.
availableResources = interface::gpib::agilent::7::10;
Where gpib is the interface being used, agilent is the interface type for the adaptor that the Tektronix scope is connected to, and the numbers are interface constructor parameters.
If you use the getDrivers function, you get information about the driver and its supported instrument models. For example:
% Get driver information. drivers = getDrivers(myScope);
This returns the driver and instrument model information.
Driver: tek Supported Models: TDS200, TDS1000/TDS2000, TDS1000B/TDS2000B, and TPS2000 TDS3000 & TDS3000B Series Digital Oscilloscopes
This example shows the general workflow to use for the Quick-Control Oscilloscope for a Tektronix scope. This feature works with any supported oscilloscope model. You can follow the basic steps using your particular scope.
Create an instance of the oscilloscope.
% Instantiate an instance of the scope. myScope = oscilloscope()
Discover available resources. A resource string is an identifier to the instrument. You must set it before connecting to the instrument.
% Find resources. availableResources = getResources(myScope)
This returns a resource string or an array of resource strings.
availableResources = interface::gpib::agilent::7::10;
Where gpib is the interface being used, agilent is the interface type for the adaptor that the Tektronix scope is connected to, and the numbers are interface constructor parameters.
Connect to the scope.
% Connect to the scope. connect(myScope);
Configure the oscilloscope.
You can configure any of the scope's properties that are able to be set. In this example enable channel 1 and set acquisition time as shown. You can see examples of other acquisition parameters in step 6 of the previous example.
% Set the acquistion time to 0.01 second. set(myScope, 'AcquistionTime', 0.01); % Set the acquistion to collect 2000 data points. set(myScope, 'WaveformLength', 2000); % Enable channel 1. enableChannel(myScope, 'Channel1');
Communicate with the instrument. For example, read a waveform.
In this example, the getWaveform function returns the waveform that was acquired using the front panel of the scope. The function can also initiate an acquisition on the enabled channel and then return the waveform after the acquisition. For examples on all the use cases for this function, see getWaveform.
% Acquire the waveform.
waveformArray = getWaveform(myScope);
% Plot the waveform and assign labels for the plot.
plot(waveformArray);
xlabel('Samples');
ylabel('Voltage');After configuring the instrument and retrieving its data, close the session and remove it from the workspace.
disconnect(myScope); clear myScope;
The oscilloscope function can use the following special functions, in addition to standard functions such as connect and disconnect.
| Function | Description |
|---|---|
| autoSetup | Automatically configures the instrument based on the input
signal.autoSetup(myScope); |
| disableChannel | Disables the oscilloscope's channel(s). disableChannel(myScope, 'Channel1');
disableChannel(myScope, {'Channel1', 'Channel2'}); |
| enableChannel | Enables the oscilloscope's channel(s) from which waveform(s)
will be retrieved. enableChannel(myScope, 'Channel1');
enableChannel(myScope, {'Channel1', 'Channel2'}); |
| getDrivers | Returns a list of available drivers with their supported instrument
models.drivers = getDrivers(myScope); |
| getResources | Retrieves a list of available resources of instruments. It
returns a list of available VISA resource strings when using an IVI-C
or IVI-COM scope. It returns the interface resource information when
using a Tektronix scope.res = getResources(myScope); |
| getVerticalCoupling | Returns the value of how the oscilloscope couples the input
signal for the selected channel name as a MATLAB string. Possible
values returned are 'AC'and 'DC'.VC = getVerticalCoupling (myScope, 'Channel1'); |
| getVerticalOffset | Returns the location of the center of the range for the selected
channel name as a MATLAB string. The units are volts.VO = getVerticalOffset (myScope, 'Channel1'); |
| getVerticalRange | Returns the absolute value of the input range the oscilloscope
can acquire for selected channel name as a MATLAB string. The units
are volts.VR = getVerticalRange (myScope, 'Channel1'); |
| getWaveform | Returns the waveform(s) displayed on the scope screen. Retrieves
the waveform(s) from enabled channel(s).w = getWaveform(myScope); |
| setVerticalCoupling | Specifies how the oscilloscope couples the input signal for
the selected channel name as a MATLAB string. Values are 'AC' and 'DC'.setVerticalCoupling (myScope, 'Channel1', 'AC'); |
| setVerticalOffset | Specifies the location of the center of the range for the selected
channel name as a MATLAB string. For example, to acquire a sine wave
that spans from 0.0 to 10.0 volts, set this attribute to 5.0 volts.setVerticalOffset (myScope, 'Channel1', 5); |
| setVerticalRange | Specifies the absolute value of the input range the oscilloscope
can acquire for the selected channel name as a MATLAB string. The
units are volts.setVerticalRange (myScope, 'Channel1', 10); |
![]() | Using IVI-C Class-Compliant Wrappers | Using Quick-Control Function Generator | ![]() |

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |