FAQs from Rohde & Schwarz

Acquisizione di una forma d'onda in modalità Analizzatore di spettro utilizzando Matlab

Domanda

Il seguente script Matlab fornisce un rapido riferimento su come spostare i dati delle forme d'onda da un analizzatore di spettro FSV3030 R&S nell'area di lavoro Matlab.

Come esempio è stato utilizzato un semplice segnale CW non modulato di 1 GHz e -30 dbm.

Risposta

+++Code+++

% Preconditions:
% - Installed latest R&S VISA
clc;
analyzer_handle = visa('rs','TCPIP::10.205.0.101::INSTR'); %visa connection, toolbox required
analyzer_handle.OutputBufferSize = 1000000; %output buffer size in bytes
analyzer_handle.InputBufferSize = 1000000; %input buffer size in bytes
fopen(analyzer_handle);

fprintf(analyzer_handle,'*RST;*WAI');
fprintf(analyzer_handle,'*IDN?');
a=fscanf(analyzer_handle);
disp(a);

fprintf(analyzer_handle,'INIT:CONT OFF'); %Selects single sweep mode.

%--------------Configuring the Frequency and Span-------------
fcenter=1000000000;
fprintf(analyzer_handle,'FREQ:CENT %d',fcenter); %Defines the center frequency
fspan=5000000;
fprintf(analyzer_handle,'FREQ:SPAN %d',fspan); %Sets the span

%--------------Configuring the Sweep--------------------------
fprintf(analyzer_handle,'SENS:SWE:COUN 1'); %Defines 1 sweep
points=10000; %nr of points sets resolution of the trace
fprintf(analyzer_handle, 'SENS:SWE:POIN %d',points);

%--------------Configuring the Bandwidth----------------------
fprintf(analyzer_handle,'BAND:AUTO OFF');
fprintf(analyzer_handle,'BAND 100000'); %Defines the RBW
fprintf(analyzer_handle,'BAND:VID 500kHz'); %Decouples the VBW from the RBW and decreases it to smooth the trace.

%--------------trace acquisition-----------------------------
timeout=30; %timeout in seconds
set(analyzer_handle,'Timeout',timeout); %timeout increased before acquisition to avoid sync errors
fprintf(analyzer_handle,'INIT:IMM;*WAI');
fprintf('Fetching waveform ...\n ');
fprintf(analyzer_handle,':FORM REAL,32');
fprintf(analyzer_handle,':TRAC? TRACE1;*WAI');
data=binblockread(analyzer_handle,'float32');
fread(analyzer_handle,1); %fread removes the extra terminator in the buffer
timeout=1; %timeout in seconds goes back to a normal value
set(analyzer_handle,'Timeout',timeout);

%--------------Presentation of the trace in a plot---------
fstart=fcenter-fspan/2;
fstop=fcenter+fspan/2;
resolution=fspan/points;
points_array=1:1:points;

for c = 1:points %scale time axis and power data

points_array(1,c)=points_array(1,c)*resolution;
points_array(1,c)=points_array(1,c) + fstart;

end

plot(points_array,data);
title('SA Spectrum Acquisition')
xlabel('frequency domain [Hz]')
ylabel('power [dbm]')

%--------------error check up----------------------
fprintf(analyzer_handle,'SYST:ERR?');
a=fscanf(analyzer_handle);
disp(a);

fclose(analyzer_handle);

+++

Di seguito è riportata la forma d'onda osservata nell'analizzatore di spettro dopo l'esecuzione dello script precedente con Matlab.

Acquisizione di una forma d'onda in modalità Analizzatore di spettro utilizzando Matlab

Ecco l'uscita del codice che presenta i dati di forma d'onda di esempio.

Acquisizione di una forma d'onda in modalità Analizzatore di spettro utilizzando Matlab
Acquisizione di una forma d'onda in modalità Analizzatore di spettro utilizzando Matlab

Inoltre, è possibile utilizzare R&S Visa Tester per rivedere in dettaglio il processo di acquisizione dei punti dati; in questo caso particolare sono stati acquisiti 10000 punti, ognuno dei quali è stato dato come valore mobile a 4 byte. Per questo motivo si leggono 40000 byte nel protocollo all'inizio dell'acquisizione, in modo che il buffer di acquisizione venga impostato di conseguenza,

Riferimenti:

-Pagina del prodotto FSV3030
https://www.rohde-schwarz.com/de/produkt/fsv3000-produkt-startseite_63493-601503.html

-Suggerimenti e trucchi per il controllo remoto degli analizzatori di spettro e di rete - Nota applicativa 1EF62_1E
https://www.rohde-schwarz.com/applications/hints-and-tricks-for-remote-control-of-spectrum-and-network-analyzers-application-note_56280-15635.html

-Controllo remoto e driver degli strumenti:
https://www.rohde-schwarz.com/driver-pages/remote-control/drivers-remote-control_110753.html