⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 basic control using scpi.m

📁 Agilent 仪器与MATLAB互联
💻 M
字号:
% MATLAB/MXA example 1
% A first MATLAB/MXA program using basic SCPI commands 

% Version: 1.0
% Date: Sep 11, 2006  
% 2006 Agilent Technologies, Inc.

% TCPIP parameters of the MXA box
mxa_ip = '141.121.92.157';
mxa_port = 5025;

% MXA Interface creation and connection opening
fprintf('\nConnecting to MXA ...\n');
mxa = tcpip(mxa_ip,mxa_port);
fopen(mxa);
 
% Intrument identification
idn = query(mxa,'*IDN?');
fprintf('Hello from %s', idn);

% Set the center frequency to 1 GHz
fprintf(mxa,':FREQ:CENT 1 GHz');

% Set the span to 20 MHz
fprintf(mxa,':FREQ:SPAN 20 MHz');

% Set the reference level to +10 dBm
fprintf(mxa,':DISP:WIND:TRAC:Y:RLEV 10');

% Query the resolution bandwidth using fprinf()/fgets()
fprintf(mxa,':BAND:RES?');
rbw = str2double(fgets(mxa));
fprintf('Resolution bandwidth: %d kHz\n', rbw/1e3);

% Query the sweep time using query()
swp = str2double(query(mxa,':SWE:TIME?'));
fprintf('Sweep time: %d ms\n', round(swp*1000));

% Close the MXA connection and clean up
fprintf('Disconnecting from MXA ...\n');
fclose(mxa); 
delete(mxa); % delete the interface object
clear mxa;   % clear from the workspace

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -