FAQs from Rohde & Schwarz

Spectrum Analyzer 모드에서 Matlab을 사용하여 트레이스 캡처하기

질문

아래의 Matlab 스크립트는 로데슈바르즈의 FSV3030 Spectrum Analyzer에서 Matlab 워크스페이스로 트레이스 데이터를 신속하게 전송하는 방법을 설명합니다.

1 GHz 및 -30 dbm의 변조되지 않은 단순한 CW 신호가 개념 증명의 예시로 사용되었습니다.

답변

+++코드+++

% 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.

%--------------주파수 및 스팬 구성-------------
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

%--------------스윕 구성--------------------------
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);

%--------------대역폭 구성----------------------
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.

%--------------트레이스 획득-----------------------------
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);

%--------------플롯에서 트레이스 표시---------
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]')

%--------------오류 확인----------------------
fprintf(analyzer_handle,'SYST:ERR?');
a=fscanf(analyzer_handle);
disp(a);

fclose(analyzer_handle);

+++

다음은 Matlab에서 위의 스크립트를 실행한 후 Spectrum Analyzer에서 관찰된 트레이스입니다.

Spectrum Analyzer 모드에서 Matlab을 사용하여 트레이스 캡처하기

개념 증명으로 트레이스 데이터를 보여주는 코드의 출력은 다음과 같습니다.

Spectrum Analyzer 모드에서 Matlab을 사용하여 트레이스 캡처하기
Spectrum Analyzer 모드에서 Matlab을 사용하여 트레이스 캡처하기

또한, R&S VisaTester를 사용하여 데이터 포인트의 획득 프로세스를 상세하게 수정할 수 있습니다. 본 페이지의 예시에서는 10000 포인트가 획득되었으며, 각 포인트의 부동값은 4 bytes입니다. 획득 버퍼가 적절하게 설정될 수 있도록 캡처 시작 단계에 로그에서 40000 bytes를 읽는 이유입니다.

참조자료:

-FSV3030 제품 페이지
https://www.rohde-schwarz.com/de/produkt/fsv3000-produkt-startseite_63493-601503.html

-스펙트럼 분석기와 네트워크 분석기의 원격 제어를 위한 요령과 팁 - 애플리케이션 노트 1EF62_1E
https://www.rohde-schwarz.com/applications/hints-and-tricks-for-remote-control-of-spectrum-and-network-analyzers-application-note_56280-15635.html

-원격 제어 및 장치 드라이버
https://www.rohde-schwarz.com/driver-pages/remote-control/drivers-remote-control_110753.html