forked from simos421/CST-MATLAB-API
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMonopoleExample.m
More file actions
92 lines (69 loc) · 2.47 KB
/
Copy pathMonopoleExample.m
File metadata and controls
92 lines (69 loc) · 2.47 KB
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
% Copyright (C) 2018 Symeon Symeonidis, Stefanos Tsantilas, Stelios Mitilineos
% simos421@gmail.com, steftsantilas@gmail.com, smitil@gmail.com
% This program is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
addpath(genpath('...\cst api'));
cst = actxserver('CSTStudio.application');
mws = cst.invoke('NewMWS');
Geometry = 'mm';
Frequency = 'GHz';
Time = 'ns';
TemperatureUnit = 'Kelvin';
Voltage = 'V';
Current = 'A';
Resistance = 'Ohm';
Conductance = 'S';
Capacitance = 'PikoF';
Inductance = 'NanoH';
CstDefineUnits(mws,Geometry, Frequency, Time, TemperatureUnit, Voltage, Current, Resistance, Conductance, Capacitance, Inductance)
CstMeshInitiator(mws)
CstDefineFrequencyRange(mws,0.5,4)
minfrequency = 0.5;
x='expanded open';
CstDefineOpenBoundary(mws,minfrequency,x,x,x,x,x,x)
XminSpace = 0;
XmaxSpace = 0;
YminSpace = 0;
YmaxSpace = 0;
ZminSpace = 0;
ZmaxSpace = 0;
CstDefineBackroundMaterial(mws,XminSpace,XmaxSpace, YminSpace, YmaxSpace, ZminSpace, ZmaxSpace)
Name = 'Groundplane';
component = 'component1';
material = 'PEC';
Xrange = [-40 40];
Yrange = [-40 40];
Zrange = [0 2];
Cstbrick(mws, Name, component, material, Xrange, Yrange, Zrange)
Name = 'Conductor';
OuterRadius = 2;
InnerRadius = 0;
Xcenter = 0;
Ycenter = 0;
Zrange = [8 38];
Cstcylinder(mws, Name, component, material, 'Z', OuterRadius, InnerRadius, Xcenter, Ycenter, Zrange)
PortNumber = 1;
SetP1 = [0 0 2];
SetP2 = [0 0 8];
CstDiscretePort(mws,PortNumber,SetP1,SetP2)
monitorindex = 2.25;
CstDefineEfieldMonitor(mws,strcat('e-field', num2str(monitorindex)), monitorindex)
CstDefineFarfieldMonitor(mws,strcat('Farfield',num2str(monitorindex)), monitorindex)
CstSaveProject(mws)
CstDefineTimedomainSolver(mws,-30)
exportpath = '...\cst api\NameofyourFile';%NameofyourFile should be the same with the name of the file of line 90 bellow
format = 'db';
CstExportTouchstone(mws,exportpath, format)
data = read(rfdata.data,'NameofyourFile.s1p');
freq = data.Freq;
s_params = extract(data,'S_PARAMETERS',50);
spar = s_params(1,:);
s11 = 20*log10(sqrt(real(spar).^2 + imag(spar).^2));
plot(freq,s11); grid on;