![Rigol DS4000E Series Скачать руководство пользователя страница 271](http://html1.mh-extra.com/html/rigol/ds4000e-series/ds4000e-series_programming-manual_1460996271.webp)
Chapter 3 Programming Examples
RIGOL
DS4000E Programming Guide
3-11
MATLAB Programming Example
Program used in this example: MATLAB R2009a
Function realized in this instance: making FFT operation on the waveform data and plotting the
waveform.
1.
Run the MATLAB software and modify the current path. In this example, the current path is modified to
be D:\Demo\MATLAB.
2.
Click File
New
Blank M-File in the Matlab interface to create an empty M file. Add the following
codes to the M file:
% Create the VISA object.
%'ni' is the seller parameter, and it can be agilent, NI, or tek,
%'USB0::0x1AB1::0x04B1::DS4A0000000001::INSTR'is the instrument resource descriptor.
% Create the instrument property. In this example, set the length of the input buffer to 2048
DS4000E = visa( 'ni','USB0::0x1AB1::0x04B1::DS4A0000000001::INSTR' );
DS4000E.InputBufferSize = 2048;
% Open the created VISA object
fopen(DS4000E);
% Read the waveform
fprintf(DS4000E, ':wav:data?' );
% Request data
[data,len]= fread(DS4000E,2048);
% Turn off the instrument
fclose(DS4000E);
delete(DS4000E);
clear DS4000E;
% Data processing. The waveform data read contains the TMC block header. The length of the header
is 11 bytes. The first two bytes are the TMC data block header identifier (#) and the width descriptor
(9) respectively. The 9 bytes following the identifier are the data length. Then, comes with the
waveform data. The last byte is the terminator (0x0A). Therefore, the effective waveform data read is
from the 12nd byte to the next-to-last byte.
wave = data(12:len-1);
wave = wave';
subplot(211);
plot(wave);
fftSpec = fft(wave',2048);
fftRms = abs( fftSpec');
fftLg = 20*log(fftRms);
subplot(212);
plot(fftLg);
Содержание DS4000E Series
Страница 1: ...RIGOL Programming Guide DS4000E Series Digital Oscilloscope Aug 2016 RIGOL TECHNOLOGIES INC...
Страница 2: ......
Страница 266: ...RIGOL Chapter 3 Programming Examples 3 6 DS4000E Programming Guide...
Страница 270: ...RIGOL Chapter 3 Programming Examples 3 10 DS4000E Programming Guide...