Unable to Correct this Error..

조회 수: 1 (최근 30일)
M C
M C 2014년 2월 7일
* *??? Error using ==> visa.visa at 241 Unable to create VISA object. The required drivers may not be installed properly.* *
clear all; close all; clc; % Clear the command window format('short', 'e'); % Setup number formatting 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);

답변 (0개)

카테고리

Help CenterFile Exchange에서 Instrument Connection and Communication에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by