NanoVNA V2 / Forum

Note: this page is a mirror of https://groups.io/g/NanoVNAV2.
Click here to join and see most recent posts.

Using Matlab for the nano vna v2 ?


FuLiiX 2021/05/06 02:56

Hello everyone,

I would like to use the nano VNA v2 with matlab for a project.
I can't find any documentation about the commands to send to use it with Matlab.
I have of course used the script provided in the wiki but it is obviously not compatible with V2.
If someone has a clue to help me, I'm interested.

Thanks for the help.

Glenn Elmore 2021/05/07 07:43

This perhaps doesn't directly answer your question but there is a path to Octave (Open Source Matlab) by way of QUCS.  Files saved as Sx1 format can be directly brought into QUCS for analysis and modeling. In turn, QUCS has hooks to Octave.

Presumably you want to go directly into Matlab for which I don't have a direct solution.

Scott 2021/05/08 15:55

Below you will find a script I have used in the past. I make no
representation that this code is free of bugs, I used it solely to
compare rfid tags attached to various materials.
Save the data in your VNA software as an sNp file and import via the
sparameters command (first paragraph)
The data can be graphed directly via YourHandle.rfplot (second paragraph)
You can use matlab commands to find the resonant frequency (third paragraph)

There's more magic you can work, but I don't have that stuff to hand.


FreeAir=sparameters('RFID-atop-FreeAir.s2p');
ClearPlastic=sparameters('RFID-atop-Plastic.s2p');
Fibreglass=sparameters('RFID-atop-Fibreglass.s2p');
f0=915e6;
freq = linspace( f0-(150e6), f0+(150e6), 1001 );

figure(2)
Fibreglass.rfplot
title( 'RFID tag centred in Fibreglass' );
print -djpeg RFID-cut-Fibreglass.jpg
figure(3)
FreeAir.rfplot
title( 'RFID tag in FreeAir' );
print -djpeg RFID-atop-FreeAir.jpg
figure(4)
ClearPlastic.rfplot
title( 'RFID tag centred on Clear Plastic' );
print -djpeg RFID-atop-ClearPlastic.jpg

s11_ClearPlastic = rfparam(ClearPlastic,1,1);s11_mag =
abs(s11_ClearPlastic);s11_db = 20*log10(s11_mag);ffreqs =
ClearPlastic.Frequencies; [dBReached_Clear,I]=min(s11_db);
ResonantFreq_Clear=ffreqs(I);
s11_FreeAir = rfparam(FreeAir,1,1);s11_mag = abs(s11_FreeAir);s11_db =
20*log10(s11_mag);ffreqs = FreeAir.Frequencies;
[dBReached_Free,I]=min(s11_db); ResonantFreq_Free=ffreqs(I);
s11_Fibreglass = rfparam(Fibreglass,1,1);s11_mag =
abs(s11_Fibreglass);s11_db = 20*log10(s11_mag);ffreqs =
Fibreglass.Frequencies; [dBReached_Fibre,I]=min(s11_db);
ResonantFreq_Fibre=ffreqs(I);
fprintf("RFID tag in free air resonance at %d with %d
dB;\n",ResonantFreq_Free,dBReached_Free);
fprintf("RFID tag atop clear plastic resonance at %d with %d
dB;\n",ResonantFreq_Clear,dBReached_Clear);
fprintf("RFID tag in fibreglass resonance at %d with %d
dB;\n",ResonantFreq_Fibre,dBReached_Fibre);

On Sat, 8 May 2021 at 00:43, Glenn Elmore <n6gn@sonic.net> wrote:

Scott 2021/05/07 22:59

Below you will find a script I have used in the past. I make no representation that this code is free of bugs, I used it solely to compare rfid tags attached to various materials.

Save the data in your VNA software as an sNp file and import via the sparameters command (first paragraph)
The data can be graphed directly via YourHandle.rfplot (second paragraph)
You can use matlab commands to find the resonant frequency (third paragraph)

There's more magic you can work, but I don't have that stuff to hand.

FreeAir=sparameters('RFID-atop -FreeAir.s2p');
ClearPlastic=sparameters('RFID -atop-Plastic.s2p');
Fibreglass=sparameters('RFID-a top-Fibreglass.s2p');
f0=915e6;
freq = linspace( f0-(150e6), f0+(150e6), 1001 );

figure(2)
Fibreglass.rfplot
title( 'RFID tag centred in Fibreglass' );
print -djpeg RFID-cut-Fibreglass.jpg
figure(3)
FreeAir.rfplot
title( 'RFID tag in FreeAir' );
print -djpeg RFID-atop-FreeAir.jpg
figure(4)
ClearPlastic.rfplot
title( 'RFID tag centred on Clear Plastic' );
print -djpeg RFID-atop-ClearPlastic.jpg

s11_ClearPlastic = rfparam(ClearPlastic,1,1);s11_ mag = abs(s11_ClearPlastic);s11_db = 20*log10(s11_mag);ffreqs = ClearPlastic.Frequencies; [dBReached_Clear,I]=min(s11_db );
ResonantFreq_Clear=ffreqs(I);
s11_FreeAir = rfparam(FreeAir,1,1);s11_mag = abs(s11_FreeAir);s11_db = 20*log10(s11_mag);ffreqs = FreeAir.Frequencies; [dBReached_Free,I]=min(s11_db) ;
ResonantFreq_Free=ffreqs(I);
s11_Fibreglass = rfparam(Fibreglass,1,1);s11_ma g = abs(s11_Fibreglass);s11_db = 20*log10(s11_mag);ffreqs = Fibreglass.Frequencies; [dBReached_Fibre,I]=min(s11_db );
ResonantFreq_Fibre=ffreqs(I);
fprintf("RFID tag in free air resonance at %d with %d dB;\n",ResonantFreq_Free,dBRea ched_Free);
fprintf("RFID tag atop clear plastic resonance at %d with %d dB;\n",ResonantFreq_Clear,dBRe ached_Clear);
fprintf("RFID tag in fibreglass resonance at %d with %d dB;\n",ResonantFreq_Fibre,dBRe ached_Fibre);

To reply to this topic, join https://groups.io/g/NanoVNAV2

View this thread on groups.io