Create a Spectrum Analyzer Measurement

This example program creates a Spectrum Analyzer measurement setup.

This VBScript program can be run as a macro in the analyzer. To do this, copy the code into a text editor file such as Notepad and save on the analyzer SSD as SA.vbs. Learn how to setup and run the macro.

See the Spectrum Analyzer commands.

See Other SCPI Example Programs

' Demonstration of basic Spectrum Analyzer measurement setup.

set pna=CreateObject("AgilentPNA835x.Application")

set scpi = pna.ScpiStringParser

CreateSAMeasurement

ConfigureAdvancedSettings

'

' Create a Spectrum Analyzer measurement

'

Sub CreateSAMeasurement

' Create a SA1 measurement on channel 1

scpi.parse "SYST:PRES"

' Create a Phase Noise channel

scpi.parse "CALC:PAR:DEL:ALL"

scpi.parse "CALC:MEAS1:DEF 'SA1:Spectrum Analyzer'"

scpi.parse "DISP:MEAS1:FEED 1"

' Set frequency range in SA Tab

scpi.Parse "SENS:FREQ:CENTER 3 GHz"

scpi.Parse "SENS:FREQ:SPAN 2 GHz"

' RBW and VBW values in SA tab

scpi.Parse "SENS:SA:BAND:RES 100 kHz"

scpi.Parse "SENS:SA:BAND:VID 10 kHz"

' Detector type in SA tab

' Choices are AVERage|SAMPle|PEAK|NORMal|NEGPeak|PSAMple|PAVerage

scpi.Parse "SENS:SA:DET:FUNC PEAK"

' Video averaging type in SA Tab

' Choices are POWer|LOG|VOLTage|VMAX|VMIN

scpi.Parse "SENS:SA:BAND:VID:AVER:TYPE VMAX"

' Center frequency step size in Advance Tab

' Set to Auto mode with SENS:FREQ:CENTER:STEP:AUTO ON

scpi.Parse "SENS:FREQ:CENTER:STEP:SIZE 20 MHz"

' RBW filter shape in Advanced Tab

' Choices are GAUSsian|FLATtop|KAISer|BLACkman|NONe

scpi.Parse "SENS:SA:BAND:SHAPE KAIS"

' Auto RBW/VBW and Span/RBW ratios in Advenced Tab

scpi.Parse "SENS:SA:BAND:VID:RAT 1.23"

scpi.Parse "SENS:SA:FREQ:SPAN:BAND:RAT 134"

End Sub

'

' Configure a few of the Advanced Settings for SA.

'

Sub ConfigureAdvancedSettings

' Set the 'Image Reject' selection.

' Choices are MIN MAX NORM NLOW NHIGH

scpi.Parse "SENS:SA:IMAGE:REJ MAX"

' Enable point mode.

' This forces the number of display points to match the FFT point count in SA tab

scpi.Parse "SENS:SA:DET:BYPASS ON"

End Sub