How to use the SPECTRAN V6 via Matlab

Quote from CYW on 30/08/2023, 17:12The noise floor shown in RTSA is around -162 dBm (spectrum in RTSA.png). However, the spectrum extracted by MatLab with the following code shows a noise floor around -155 dBm (spectrum extracted by MatLab.png). Where does this discrepancy come from? (The mission file is attached)
import matlab.net.*
import matlab.net.http.*address = 'http://localhost:54664/';
blockName = 'Block_Spectran_V6B_0';
RTSASuite = AaroniaHTTP(address);%Get the Blockgraph configuration attached to the HTTP Server block
[remoteConfig, statusCode] = RTSASuite.getRemoteConfig();
% disp(jsonencode(remoteConfig));%ask for the health status
[healthstatus, statusCode] = RTSASuite.getHealthStatus();
% disp(jsonencode(healthstatus))f = 1.2e9
%Set Spectran V6 paramater
[response, statusCode] = RTSASuite.setValueParameter( ...
blockName ,'main', 'float', 'centerfreq',f);RTSASuite.setEnumParameter( blockName ,'calibration', 'preamp'...
,5 , 'Disabled,Auto,None,Amp,Preamp,Both');RTSASuite.setEnumParameter( blockName ,'main', 'decimation'...
,1 , '1 / 512');%start the measurement and wait for it running
RTSASuite.startStreaming();
pause(0.5);% Get Spectra data
r = RequestMessage;
resp = send(r,URI(append(address , 'sample')));
disp( resp.Body.Data );
spectrum = resp.Body.Data.samples;x = linspace(resp.Body.Data.startFrequency,resp.Body.Data.endFrequency, length(spectrum));
%figure
plot(x-f,spectrum,'.','MarkerSize',20);
set(gca,'FontSize',20);
xlabel('f-input f (Hz)');
ylabel('Power in dBm');
title('RTSA Spectra, Spectran V6');
The noise floor shown in RTSA is around -162 dBm (spectrum in RTSA.png). However, the spectrum extracted by MatLab with the following code shows a noise floor around -155 dBm (spectrum extracted by MatLab.png). Where does this discrepancy come from? (The mission file is attached)
import matlab.net.*
import matlab.net.http.*
address = 'http://localhost:54664/';
blockName = 'Block_Spectran_V6B_0';
RTSASuite = AaroniaHTTP(address);
%Get the Blockgraph configuration attached to the HTTP Server block
[remoteConfig, statusCode] = RTSASuite.getRemoteConfig();
% disp(jsonencode(remoteConfig));
%ask for the health status
[healthstatus, statusCode] = RTSASuite.getHealthStatus();
% disp(jsonencode(healthstatus))
f = 1.2e9
%Set Spectran V6 paramater
[response, statusCode] = RTSASuite.setValueParameter( ...
blockName ,'main', 'float', 'centerfreq',f);
RTSASuite.setEnumParameter( blockName ,'calibration', 'preamp'...
,5 , 'Disabled,Auto,None,Amp,Preamp,Both');
RTSASuite.setEnumParameter( blockName ,'main', 'decimation'...
,1 , '1 / 512');
%start the measurement and wait for it running
RTSASuite.startStreaming();
pause(0.5);
% Get Spectra data
r = RequestMessage;
resp = send(r,URI(append(address , 'sample')));
disp( resp.Body.Data );
spectrum = resp.Body.Data.samples;
x = linspace(resp.Body.Data.startFrequency,resp.Body.Data.endFrequency, length(spectrum));
%figure
plot(x-f,spectrum,'.','MarkerSize',20);
set(gca,'FontSize',20);
xlabel('f-input f (Hz)');
ylabel('Power in dBm');
title('RTSA Spectra, Spectran V6');


Quote from mm_dev on 31/08/2023, 13:46Quote from CYW on 30/08/2023, 16:05The exact same Matlab code works perfectly if the "HTTP Server" block connects to the "IQ Power Spectrum" block, as shown in the mission file attached in this post. In other words, the code works for the mission attached in post # 80 but show the error message for the mission attached in post# 78. Therefore, it seems to me that somehow the output of the "IQ Power Spectrum" block is different from the output of the "Spectrum" block, and hence it is an issue about the data type of these 2 blocks.
Wrong. The general output format of both blocks is the same (JSON structure that has a "samples" field which is an array of arrays of numbers). So either for some reason you're receiving a different format, or matlab for some reason is unpacking the data differently than before (going by documentation, it tries to analyze the result to unpack it for convenience). Quite possible that you're not getting any data at all. So there would be nothing to fix in your code (other than proper error handling). That is why it is relevant to see what is actually returned by the send function.
Quote from CYW on 30/08/2023, 16:05The exact same Matlab code works perfectly if the "HTTP Server" block connects to the "IQ Power Spectrum" block, as shown in the mission file attached in this post. In other words, the code works for the mission attached in post # 80 but show the error message for the mission attached in post# 78. Therefore, it seems to me that somehow the output of the "IQ Power Spectrum" block is different from the output of the "Spectrum" block, and hence it is an issue about the data type of these 2 blocks.
Wrong. The general output format of both blocks is the same (JSON structure that has a "samples" field which is an array of arrays of numbers). So either for some reason you're receiving a different format, or matlab for some reason is unpacking the data differently than before (going by documentation, it tries to analyze the result to unpack it for convenience). Quite possible that you're not getting any data at all. So there would be nothing to fix in your code (other than proper error handling). That is why it is relevant to see what is actually returned by the send function.

Quote from CYW on 31/08/2023, 20:25Quote from AdminTC on 30/08/2023, 22:05Looks like you are comparing AVERAGE vs CLEAR/WRITE which for sure cant be the same.
I would like to achieve the -162 dBm noise floor as shown in the RTSA screenshot of spectrum average in post #81. How can I modify the MatLab code in post #81 such that it extract the "average" data instead of the "clear/write" data?
Quote from AdminTC on 30/08/2023, 22:05Looks like you are comparing AVERAGE vs CLEAR/WRITE which for sure cant be the same.
I would like to achieve the -162 dBm noise floor as shown in the RTSA screenshot of spectrum average in post #81. How can I modify the MatLab code in post #81 such that it extract the "average" data instead of the "clear/write" data?