Specifications
3 Programming Demos RIGOL
DS2000 Programming Guide
3-17
Matlab Programming Demo
The function of the program: make FFT operation on the waveform data and draw
the waveform. You need to install the Matlab.
1. Create the WaveData.m file under the user-defined directory.
2. Create the device. The first parameter is the distributor and can be Agilent, NI
or Tek. The second parameter is the resource descriptor. You need to set the
properties of the device after creating the device. In this demo, the length of the
input buffer is set to 2048.
a) ds2000 = visa( 'ni','USB0::0x1AB1::0x04B0::DS2A0000000001::INSTR' );
ds2000.InputBufferSize = 2048;
3. Turn on the device.
fopen( ds2000 );
4. Request data.
[data,len]= fread( ds2000, 2048 );
5. Turn off the device.
fclose( ds2000 );
delete(ds2000);
clear ds2000;
6. Data processing. The waveform data read contains TMC header. The length of
the header is 11 bytes, wherein, the first 2 bytes are the TMC header denoter (#)
and the width descriptor (9) respectively, the 9 bytes following are the length of
the data, then the waveform data and the last byte is the terminator (0x0A).
Therefore, the effective waveform points read is from the 12nd to the next to
last.