No BSD License  

Highlights from
RSA3000 TImed Sweep

RSA3000 TImed Sweep

by

 

22 Jun 2008 (Updated )

This program is designed to record a spectrum trace from a Tektronix RSA3000A/B at a fixed interval

RTSA300_Timed_Sweep.m
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%  2008 Tektronix RTSA Demo program
%
%  This program provides a simple example of VISA control of an RSA3000B series
%  spectrum analyzer through MATLAB
%
%  To complete this demo you should have TEK VISA installed as well as MATLAB
%   with the intrument control toolbox.  
%
%  This program is designed to record a spectrum trace at a fixed interval
%  into the array caled trace_data, and then plot this trace data
%  
%  Version 2008.03.31.A
%
%  Copyright 2008 Tektronix Inc.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clear all;
close all;
clc;                    % Clear the command window
format('short', 'e');   % Setup number formating to Engineering short form

%% User Setup
%
number_traces= 5;                 % setup to capture N number of traces
%
%% Step 1: Open the VISA connection to the RSA
%
rtsa = visa( 'tek' , 'TCPIP::192.168.1.113::INSTR');

set( rtsa, 'InputBufferSize', 131072 );                 % Set input buffer, should be 4x number of trace points minimum
set( rtsa, 'Timeout', 20.0 );                       % Set long GPIB time-out in case of long sweeps
fopen( rtsa );

[ strIDN, numChars, errMsg ] = query( rtsa, '*IDN?' );
disp(['Spectrum Analyzer : ' strIDN]);

%% Step 2: Setup the RSA using SCPI commands
%
fprintf( rtsa, 'INST "SANORMAL"');              % Setup RSA for Standard Spectrum Analyzer
fprintf( rtsa, '*RST' );query( rtsa, '*OPC?' ); % Reset instrument and wait for completion
fprintf( rtsa, ':SENS:FREQ:STAR 2.44GHz' );        % Set start frequency
fprintf( rtsa, ':SENS:FREQ:STOP 2.45GHz' );        % Set stop frequency
% fprintf( rtsa, ':SENS:SPEC:BWID:RES:AUTO off' );   % Set RBW to user defined value
%fprintf( rtsa, ':SENS:SPEC:BWID:RES 5Hz' );   % Set RBW to user defined value
fprintf( rtsa, ':INPUT:MLEV -30' );             % Set reference level
fprintf( rtsa, ':INIT:CONT OFF' );              % Turn Off Free Run

%% Step 3:  Start Sweep, Fetch Trace, Add To Matrix
%
fprintf( rtsa, ':READ:SPEC?' );          % Fetch the trace
trace = ParseBinary32Bit_SCPI( rtsa );   % Convert the trace
trace_data = trace;                      % Add trace to trace data array
x_range = numel(trace_data);             % Calculate # of elements in trace arrray
disp(['Number of Trace Elements =' num2str(x_range)]);
%
counter1 = 1;

start_time = clock;
while counter1 <= number_traces   %                                
    current_time = clock;                           % get the current time
    time_interval = etime2(start_time,current_time);
    if time_interval(4) >= 1                     % wait for at least a n second interval
        disp(['Getting Trace #: ' num2str(counter1)]);
        fprintf( rtsa, ':READ:SPEC?' );                     % Fetch the trace
        trace = ParseBinary32Bit_SCPI( rtsa );              % Convert the trace
        trace_data=[trace_data ; trace];                    % add trace to the trace array
        start_time= clock;                % set the start_time for calculation of the next interval
        counter1=counter1+1;              % Increment trace counter
    end   
end

%% Plot Data
%
figure(1);
surf(trace_data);
shading interp;
axis tight;
grid on;
xlabel('Frequency Index');
ylabel('Location Index');
zlabel('Amplitude (dBm)');
zlim([-140 -40]);
title(strIDN);


Contact us