A bit of Maths

Having another go at calculating the optimum output match for a generic LNA I had a play in MatLab, but being less than familiar with MatLab I wanted to double check my results.

Perl is an easy to use programming language, and has an extenion for complex numbers, which makes things easy.  Supplying the input gamma, along with the S-parameters for the optimum input match for minimum noise from the datasheet, this attempts to calculate the optimum output match from the formula:


 It is reasonably simple to use Perl to calculate this once the Math::Complex library is loaded, complex numbers can be manipulated with the same ease as real numbers, thanks to the wonders of operator overloading.

To check the program, the values from the  paper which included a worked example. However when I ran the calculation, I did not get the published results ...infact, it was not even close ... and after two days of head scratching and questioning whether I could even do basic maths, I posted the question the UK Microwave group, and sure enough, someone (M0GXT, Glyn) who actually had paid attention in class spotted the error ... not in my workings, but in the published equation.  It should have had a "+" symbol between the S22 and the fraction not an implied multiplication!

The correct equation is:

 With the correct formula, the results came out fine, the program is shown below.

#!/bin/perl

use warnings;
use strict;

use Math::Complex ;


# From datasheet, input match for optimum NF, as a refelction coefficient
my($gammaInput)=cplxe(0.36, rads(121));
# From datasheet, S parameters in mag, angle form, *not* dB angle form!
my($s11) = cplxe(0.64, rads(171));     # Looking into input
my($s21) = cplxe(6.2, rads(64));       # Fwd gain
my($s12) = cplxe(0.066, rads(26.5));   # reverse gain
my($s22) = cplxe(0.15, rads(-154.5));  # Looking into output



# Base impedance, normally 50 ohms, resisitive.
my($z0) = Math::Complex->make(50,0);

my($zIn)= gammaToImpedance($gammaInput,$z0);

$zIn->display_format('cartesian');
print "Input match: $zIn \n";

my($gammaOutput) = ~($s22 + (($s21*$gammaInput*$s12)/(1-$s11*$gammaInput)));
$gammaOutput->display_format('polar');

print "Ouptut gamma: ".$gammaOutput->rho."/".degrees($gammaOutput->theta())." degrees\n";

my($zOut) = gammaToImpedance($gammaOutput,$z0);
$zOut->display_format('cartesian');
print "Output match: $zOut \n";

# Helpers

sub gammaToImpedance{
  my($gamma,$z)=@_;
  return $z*((1+$gamma)/(1-$gamma));
}

sub rads{
  my ($degrees) = shift;
  return $degrees * pi/180;
}

sub degrees{
  my ($rads) = shift;
  return 180 *$rads/ pi;
}


Using values from the datasheet for the SAV541+ at 2.5 GHz, the output from the program looks as follows:


Putting the values of 27.2 + 6.85J ohms into SimSmith as the load impedance, it is then possible to calculate a matching circuit, which comes out as 43 degrees of 50R microstrip, and a 2.2pF capacitor:


 Finally, the PCB and schematic were updated to include these new output matching values.


Interestingly, a revised version of that paper is available, which has corrected the mistake in the formula:

https://www.maximintegrated.com/en/design/technical-documents/app-notes/3/3169.html


Comments

Popular posts from this blog

DIY Plated Through Holes

KST2YOU - An alternative interface to KST

23cm Antenna progress