Please or Register to create posts and topics.

How to use the SPECTRAN V6 via Matlab

PreviousPage 2 of 9Next

I have your SPECTRAN V6 product and I have now problems of connecting
the device to Matlab. With your Aaronia-RTSA-Suite Pro program the
device is working with IQ 92 MS/s (I would like to have higher sampling
rate there also, but cannot get even when connected to 2 USB3 ports?),
and with Matlab example codes you have provided in the forum website, I am
not able to access the device by Matlab. I am using the localhost:port
shown by Aaronia-RTSA-Suite Pro ( localhost:55442), but for instance by
accessing via AaroniaHTTP.m file, I will get always an error:

Error using (line 1335)
Error connecting to http://localhost:55442/sample: Failed to connect to
port 55442: Connection refused

when trying to read samples.

Can you advice me what am I missing now, and how to proceed ?

It looks like your missing a key for higher RTBWs.

Are you sure you have a 120MHz or 245MHz IQ key?

In addition to the missed RTBW key, it seems as if the FREE INCLUDED KEYs are not loaded.


Please check the RTSA-Suite PRO License Manager [ALT]+[L] and add it manually (from provided USB Stick):

Free included Keys

Even if it was not a license key issue  (as succested by AdminTC and pmar), before using the example code in Matlab make sure the HTTP Server block is providing the related data. To do so, you can easily enter the related HTTP endpoint into your webbrowser to check if you get a response by the RTSA Suite. It should look like following:



In the RTSA-http-Stream-Server-Endpoints-8.pdf document there is text about the Raw Data Format. Could you please advice me how to access this raw data by Matlab. I cannot figure out this from the text of the document.

You can select the output format using the "format" query parameter. Supported values are "int16", "float16", "float32" or "json".

The "format" parameter is only available when using the /stream endpoint, which by default will continously send data at a potentially very high rate. You can use the "limit" parameter to only request a finite amount of samples.

jhexa, have a look at the "C++ Just IQ Data Streaming" example which is using the Stream endpoint of the HTTP Server block.

Thanks for the help! Now my streaming is working fine, but I have faced the next challenge related to the conversion the gathered raw16 IQ data stream to correct numerical form.

So what is wrong in the following Matlab code? The result (I and Q) obtained with the code below does not make any sense.

j = strfind(char(res)','samples')+17;
for i=1:length(j)
I = [I ((256*x1 + x2))];
Q = [Q ((256*x1 + x2))];




Sorry, in the last code the loop  (for i=1:length(j) ..) of course should have j(i) instead of j (I by accidently copied an old code version).

jhexa, you had multiple errors in your code. If the received packets have all the same amount of samples, following code should work:

j = strfind(char(res)',char([125 10 30])) + 2;
header = jsondecode(char(res(1:(j(1)-2)))');
I=[]; Q=[];
size = header.samples*4;

for i=1:length(j)
values = typecast(res(j(i):(j(i) + size -1)), 'int16');
I = [I (double( values(1:2:size/2) )/header.scale)];
Q = [Q (double( values(2:2:size/2) )/header.scale)];

IQData = I(1:end,1)+1i*Q(1:end,1);
fftsize = 1024+4;

if(fftsize > 1)
fftWindow = hann(fftsize)*2;
y = fftshift( fft( IQData(1:fftsize).*fftWindow, fftsize ) ) ;

y = abs(y/fftsize).^2;
y = y/50;
y = 10*log10( y / 0.001 );

x = linspace(header.startFrequency, header.endFrequency, fftsize);

xlabel('Frequency in Hz');
ylabel('Power in dBm');
title('Spectrum of RTSA IQ Data');
disp('No data to plot');

PreviousPage 2 of 9Next