为了正常的体验网站,请在浏览器设置里面开启Javascript功能!
首页 > MXA-N9020A编程纪要

MXA-N9020A编程纪要

2012-02-05 13页 pdf 152KB 85阅读

用户头像

is_849218

暂无简介

举报
MXA-N9020A编程纪要 安捷伦 MXA N-9020A信号分析仪编程 权利声明: 本文系雷声天下个人学习使用,愿与广大网友分享,仅可用于教育、研究用途,如用于商业用途,一经发现,必然追究当事人责任! 1 网上资料整理 (以下内容选自 http://www.mathworks.cn/products/instrument/demos.html?file=/products/demos/shipping/instrument/acquireIQSignal.html) 1.1 介绍 本文展示了如何从安捷伦 X-系列信...
MXA-N9020A编程纪要
安捷伦 MXA N-9020A信号分析仪编程 权利声明: 本文系雷声天下个人学习使用,愿与广大网友分享,仅可用于教育、研究用途,如用于商业用途,一经发现,必然追究当事人责任! 1 网上资料整理 (以下内容选自 http://www.mathworks.cn/products/instrument/demos.html?file=/products/demos/shipping/instrument/acquireIQSignal.html) 1.1 介绍 本文展示了如何从安捷伦 X-系列信号分析仪中通过 TCP/IP接口获取数据。本文实验使用了 N9020A,MXA信号分析仪。 1.2 需求 运行本文的实例需要安捷伦 N9020A信号分析仪。 1.3定义测量参数 在进行测量之前需要定义一些参数,根据你所测量的信号,你需要定义如下参数。 % Specify the IP address of the signal analyzer 设置信号分析仪 IP地址 addressMXA = '10.123.123.123'; % Specify the IP address of the signal analyzer 设置信号分析仪 IP地址 addressMXA = '10.123.123.123'; % Center frequency of the modulated waveform (Hz) 调制信号的中心频率 centerFrequency = 2.14e9; % Bandwidth of the signal (Hz) 信号带宽 bandwidth = 25e6; % Measurement time (s) 测量时间 measureTime = 8e-3; % Mechanical attenuation in the signal analyzer(dB) 信号分析仪机械衰减 mechAttenuation = 0; % Start frequency for Spectrum Analyzer view 信号分析仪开始频谱 startFrequency = 2.11e9; % Stop frequency for Spectrum Analyzer view 信号分析仪截至频谱 stopFrequency = 2.17e9; % Resolution Bandwidth for Spectrum Analyzer view 频谱分析仪视图分辨率带宽 resolutionBandwidth = 200e3; % Video Bandwidth for Spectrum Analyzer view 频谱分析仪视频带宽 videoBandwidth = 300; 1.4 与仪器链接 在连接到仪器之前应当完成以下工作 a 通过链接网线,建立起仪器和电脑之间的物理连接 b 调整输入缓存的大小以确保仪器的回传数据可以被保存下来 c 建立最大时间参数,以保证数据传送有一个时间限制 d 链接到仪器上 %%=====================================================================================%% % establish a TCP/IP object with the IP address and the interface number 建立一个 TCP/IP对象 参数包括了前述 IP地址和相应的端口设置,如本地的 5025 signalAnalyzerObject=tcpip(addressMXA, 5025); % set the size of the Buffer 设定数据缓存的大小 set(signalAnalyzerObject,'InputBufferSize',30e6); % set the timeout parameter 设定数据传输最大延时 set(signalAnalyzerObject,'Timeout',20); % open the instrument object 打开仪器设备对象,正式建立连接 fopen(signalAnalyzerObject); %%=====================================================================================%% 1.5 查询仪器识别信息 重启设备使得设备明确当前处在 SCPI命令模式下。询问设备的识别豪门以确定当前链接的仪器设备是正确的。 %%=====================================================================================%% % send the Reset command 发送重启命令 fprintf(signalAnalyzerObject, '*RST'); % send the check command to aqcuire the identification information 发送查询命令,获取仪器设备识别信息 instrumentInfo = query(signalAnalyzerObject, '*IDN?'); % show the identification information of the instrument in command window 在 Command window中显示设备的识别信息 disp(['Instrument identification information: ' instrumentInfo]); %%Instrument identification information: Agilent Technologies,N9020A,MY48011248,A.03.08 可以看到如此的信息 %%======================================================================================%% 1.6 初始化设备采用 IQ波形模式测量 X-系列的信号分析仪采用 IQ测量也采用频率测量。在本例子中需要时域的 IQ数据,并且对这些数据进行信号处理。利用 SCPI命令对仪器的测量和数据传 输格式进行定义。 %%======================================================================================%% % Set up signal analyzer mode to Basic/IQ mode 发送信号分析仪模式设置命令,设定为基本模式 fprintf(signalAnalyzerObject,':INSTrument:SELect BASIC'); % Set the center frequency 发送中心频率设置命令,注意需要将数据参数转换成字符串格式 fprintf(signalAnalyzerObject,[':SENSe:FREQuency:CENTer ' num2str(centerFrequency)]); % Set the resolution bandwidth 发送分辨率设置命令,注意将数据参数转换成字符串格式 fprintf(signalAnalyzerObject,[':SENSe:WAVEform:BANDwidth:RESolution ' num2str(bandwidth)]); % Turn off averaging 发送命令去除、关闭均值 fprintf(signalAnalyzerObject,':SENSe:WAVeform:AVER OFF'); % set to take one single measurement once the trigger line goes high 发送命令设定??? fprintf(signalAnalyzerObject,':INIT:CONT OFF'); % Set the trigger to external source 1 with positive slope triggering 发送命令设定触发模式为正跳变触发,且有一个外部信号源作为输入 fprintf(signalAnalyzerObject,':TRIGger:WAVeform:SOURce EXTernal1'); fprintf(signalAnalyzerObject,':TRIGger:EXTernal1:SLOPe POSitive'); % Set the time for which measurement needs to be made 发送命令设定测量时长,注意应将参数转换成字符串格式 fprintf(signalAnalyzerObject,[':WAVeform:SWE:TIME ' num2str(measureTime)]); % Turn off electrical attenuation. 发送命令,关闭电子衰减 fprintf(signalAnalyzerObject,':SENSe:POWer:RF:EATTenuation:STATe OFF'); % Set mechanical attenuation level 发送命令设定机械衰减值,注意到和上面的电子衰减设定不同,这里采用的数值设定,而上面是状态设定 fprintf(signalAnalyzerObject,[':SENSe:POWer:RF:ATTenuation ' num2str(mechAttenuation)]); % Turn IQ signal ranging to auto 打开 IQ信号范围设定,将其设定为自动模式 fprintf(signalAnalyzerObject,':SENSe:VOLTage:IQ:RANGe:AUTO ON'); % Set the endianness of returned data 发送命令设置回传数据格式为大端对齐模式 fprintf(signalAnalyzerObject,':FORMat:BORDer NORMal'); % Set the format of the returned data 设定回传数据的格式为 32位模式 fprintf(signalAnalyzerObject,':FORMat:DATA REAL,32'); %%===========================================================================================%% 1.7 启动仪器 启动仪器等待设备运行完成,然后读取波形数据。在进行数据处理之前,分别将返回交错数据的 I和 Q部分,在Malab中进行创建复向量。 %%===========================================================================================%% % Trigger the instrument and initiate measurement 发送命令打开仪器,测量初始化 fprintf(signalAnalyzerObject,'*TRG'); fprintf(signalAnalyzerObject,':INITiate:WAVeform'); % wait till measure operation is complete 发送命令,询问是否完成了测量,此处会一直等待测量完成 measureComplete = query(signalAnalyzerObject,'*OPC?'); % Read the IQ data 发送命令,读取数据,使用了 binblockread命令 fprintf(signalAnalyzerObject,':READ:WAV0?'); data=binblockread(signalAnalyzerObject,'float'); % Read the additional terminator character from the instrument 从仪器读取附加终止字符 fread(signalAnalyzerObject,1); % Separate the data and build the complex IQ vector. 从数据获取 IQ复值信号 inphase=data(1:2:end); quadrature=data(2:2:end); IQData=inphase+1i*quadrature; %%============================================================================================%% 1.8 显示测量数据 从仪器获取重要数据,并且将这些数据图形化显示 %%============================================================================================%% fprintf(signalAnalyzerObject,':FETCH:WAV1?'); %%发送命令,获取数据的信息,注意这里和上面不一样,是WAV1 signalSpec = binblockread(signalAnalyzerObject,'float');%%读取数据存储成 signalSpec,留待后续处理 sampleRate = 1/signalSpec(1); disp(['Sample Rate (Hz) = ' num2str(sampleRate)]);%%显示采样率 disp(['Number of points read = ' num2str(signalSpec(4))]);%%显示数据的数量 disp(['Max value of signal (dBm) = ' num2str(signalSpec(6))]);%%显示数据的最大值 dBm disp(['Min value of signal (dBm) = ' num2str(signalSpec(7))]);%%显示数据的最小值 dBm,注意这里面的所有数据都是要转换成字符串格式?但是为什么不是 相反的? %%以上命令会有以下数据在 Command window中显示 %%Sample Rate (Hz) = 44999999.8738 %%Number of points read = 360001 %%Max value of signal (dBm) = -64.8261 %%Min value of signal (dBm) = -130.6566 %%==============================================================================================%% 1.9 画出 IQ数据 画出时域信号的 1000个点,并且对图片进行 %%==============================================================================================%% plot(real(IQData(1:1000)),'b'); hold on; plot(imag(IQData(1:1000)),'g'); legend('Inphase signal', 'Quadrature signal'); title('IQ Data for the first 1000 points of acquired signal') xlabel('Sample number'); ylabel('Voltage'); %%===============================================================================================%% 1.10 画出 IQ数据的频谱图 频域图像比时域图像更有价值,需要使用 DSP System Toolbox画出频谱图。 %%===============================================================================================%% % Create a periodogram spectrum with a Hamming window 创建一个海明窗用于进行分析,将句柄赋值给 hp hp = spectrum.periodogram('hamming'); % Create a power spectral density options object 创建一个能量频谱分析窗口,利用 IQ数据 hpopts = psdopts(hp,IQData); % set the options for the periodogram 设定相应的选项 set(hpopts,'Fs',sampleRate,'SpectrumType','twosided','centerdc',true); % calculate the PSD 计算功率频谱密度 hpsd = psd(hp,IQData,hpopts); % plot the PSD of the acquired signal 画出功率频谱密度 figure; plot(hpsd); %%===============================================================================================%% 1.11 切换仪器状态返回到频谱分析模式 切换仪器状态返回到频谱分析模式,对比频谱视图和信号分析仪视图。使用附加的 SCPI命令用于配置仪器测量和显示设置。 %%===============================================================================================%% % Switch back to the spectrum analyzer view 发送命令,设置仪器状态为频谱分析状态 fprintf(signalAnalyzerObject,':INSTrument:SELect SA'); % Set mechanical attenuation level 发送命令,设置机械衰减值 fprintf(signalAnalyzerObject,[':SENSe:POWer:RF:ATTenuation ' num2str(mechAttenuation)]); % Set the center frequency, RBW and VBW and trigger 发送命令,设置中心频率、开始频率、截止频率、分辨率和视频带宽 fprintf(signalAnalyzerObject,[':SENSe:FREQuency:CENTer ' num2str(centerFrequency)]); fprintf(signalAnalyzerObject,[':SENSe:FREQuency:STARt ' num2str(startFrequency)]); fprintf(signalAnalyzerObject,[':SENSe:FREQuency:STOP ' num2str(stopFrequency)]); fprintf(signalAnalyzerObject,[':SENSe:BANDwidth:RESolution ' num2str(resolutionBandwidth)]); fprintf(signalAnalyzerObject,[':SENSe:BANDwidth:VIDeo ' num2str(videoBandwidth)]); % Continuous measurement 发送命令,初始化仪器 fprintf(signalAnalyzerObject,':INIT:CONT ON'); % Trigger 发送命令开启仪器 fprintf(signalAnalyzerObject,'*TRG'); %%===============================================================================================%% 1.12 关闭仪器连接,清理 %%===============================================================================================%% % Close and delete instrument connections fclose(signalAnalyzerObject); %%关闭信号分析对象,即切断网络连接 delete(signalAnalyzerObject); %%删除网络连接 clear signalAnalyzerObject; %%从 workspace中清理掉这个对象 %%===============================================================================================%% 安捷伦 MXA N-9020A信号分析仪编程 1 网上资料整理 1.1 介绍 1.2 需求 1.3定义测量参数 1.4 与仪器链接 1.5 查询仪器识别信息 1.6 初始化设备采用IQ波形模式测量 1.7 启动仪器 1.8 显示测量数据 1.9 画出IQ数据 1.10 画出IQ数据的频谱图 1.11 切换仪器状态返回到频谱分析模式 1.12 关闭仪器连接,清理
/
本文档为【MXA-N9020A编程纪要】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑, 图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。 本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。 网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。

历史搜索

    清空历史搜索