Hi Jerry,
Your guess regarding how the Matlab function is used is correct. Four gamma measurements need to be recorded. They represent S11 values for a short, an open, the reference load, and the device-under-test. The first three of these are used to correct the last via the formula posted.
The Matlab syntax can be a bit confusing. It¡¯s a language based upon operations with arrays, and thus some of the operators relate to that.
So, in the function I mentioned, the gamma terms are all arrays ¡ª in the case of the NanoVNA each gamma array might consist of 2 x 101 elements (e.g read from an s1p file). One set of elements would be the 101 frequencies measured in the NanoVNA¡¯s scan, and the other set of elements would be the 101 complex values representing the S11 measured at each frequency.
To correct the measured S11 for all of the frequencies measured, you¡¯d need to do the math defined in the equation 101 times ¡ª that is, do it at each frequency for the four gammas captured at that frequency.
You don¡¯t need Matlab to do these calculations ¡ª they could easily be done with ¡®for¡¯ loops.
Regarding the Thru measurement, I haven¡¯t looked into it¡¯s correction yet. This link discusses the error terms: , but does not give the final correction equation.
Plus, part of the NanoVNA¡¯s cal routine involves Isolation (disregarded in the link I just pointed to). How is this used? (And is it even necessary for the NanoVNA?)
When I get back into town I want to try to find a link to the actual Nano code ¡ª that might help answer the questions I have.
- Jeff