File: a2s.m

package info (click to toggle)
openems 0.0.35%2Bdfsg.1-3
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 6,288 kB
  • sloc: cpp: 40,259; yacc: 580; lex: 350; makefile: 258; sh: 169; ruby: 19
file content (31 lines) | stat: -rw-r--r-- 805 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
function s = a2s(a,ref)
% s = a2s(a [,ref])
%
% ABCD to Scattering Matrix transformation (only for 2x2xf matrices)
%
% input:
%   a:   ABCD matrix 2x2xf   (f: number of frequencies)
%   ref: (optional) reference impedance (default 50 Ohm)
%
% output:
%   s:   S-matrix 2x2xf normalized to ref Ohm
%
% Reference: David M. Pozar "Microwave Engineering"
%
% Sebastian Held <sebastian.held@gmx.de>
% Sep 1 2010

if nargin < 2
    Z0 = 50;
else
    Z0 = ref;
end

A = squeeze(a(1,1,:));
B = squeeze(a(1,2,:));
C = squeeze(a(2,1,:));
D = squeeze(a(2,2,:));
s(1,1,:) = (A + B./Z0 - C.*Z0 - D) ./ (A + B./Z0 + C.*Z0 + D);
s(1,2,:) = 2*(A.*D - B.*C) ./ (A + B./Z0 + C.*Z0 + D);
s(2,1,:) = 2 ./ (A + B./Z0 + C.*Z0 + D);
s(2,2,:) = (-A + B./Z0 - C.*Z0 + D) ./ (A + B./Z0 + C.*Z0 + D);