Code covered by the BSD License  

Highlights from
Agilent Spectrum Analyzer Seminar Examples

image thumbnail
from Agilent Spectrum Analyzer Seminar Examples by Richard Overdorf
Agilent MXA, PSA Seminar Examples

MXA_GetYScaling( handle )
function [yMin, yMax] = MXA_GetYScaling( handle )
% MXA_GetYScaling  Returns the y scaling parameters from the MXA.
%   This function reads back the reference level and y scale/division
%   parameters from the MXA and calculates the minimum and maximum
%   values for the y-axis plots.

if handle ~= -1
    %*---------------------------------------------------*
    %  Live mode
    %*---------------------------------------------------*
    % Read the reference level
    fprintf( handle, 'DISP:WIND:TRAC:Y:RLEV?' );
    yMax = fscanf( handle, '%f' );
    
    % Read the scaling
    fprintf( handle, 'DISP:WIND:TRAC:Y:PDIV?' );
    yScale = fscanf( handle, '%f' );
    
    % Calculate yMin
    yMin = yMax - 10 * yScale;
    
else
    %*---------------------------------------------------*
    %  Debug mode
    %*---------------------------------------------------*
    % Simulate instrument
    yMin = -100;
    yMax = 0;
    
end

Contact us at files@mathworks.com