FAQs from Rohde & Schwarz

Matlab: Remote Control example for NRP-Zxx power sensors with NI-VISA

Question:

Do you have an example in Matlab to remote control the NRP-Zxx power sensors?

Answer:

For this you need to install:

  • the NI-VISA
  • NRP-NI-VISA Passport https://www.rohde-schwarz.com/software/nrpz/

Here the example for an average measurement with the NRP-Z21:

function NRPZ21_Avg_Meas(NRPZ21)

NRPZ21 = visa('ni','RSNRP::0x0003::104406::INSTR');
fopen(NRPZ21);
fprintf(NRPZ21,'*IDN?');
a=fscanf(NRPZ21); %get the identifier
disp(a); %show the identifier fprintf(NRPZ21,'INIT:CONT:OFF'); %switch to single measurement mode
fprintf(NRPZ21,'SENS:FUNC "POW:AVG"'); %switch average measurement mode
fprintf(NRPZ21,'SENS:FREQ 1e+9'); %set frequency to 1GHz
fprintf(NRPZ21,'SENS:AVER:COUN:AUTO ON'); %average count is automatically selected
fprintf(NRPZ21,'SENS:AVER:STAT ON'); %switch averaging on
fprintf(NRPZ21,'SENS:AVER:TCON REP'); %only a new complete average measurement is used
fprintf(NRPZ21,'INIT:IMM'); %a measurement is initiated
response=16;
while response==16 % check if the sensor is still measuring
fprintf(NRPZ21,'STAT:OPER:COND?'); % get the status
response=uint16(str2double(fscanf(NRPZ21)));
end
fprintf(NRPZ21,'FETCH?'); %get the result
a=fscanf(NRPZ21);
disp(a); %show the result

fclose(NRPZ21); %close connection

end