-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathseries_singlestub.m
151 lines (104 loc) · 3.25 KB
/
series_singlestub.m
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
prompt = 'What is Z0 ';
Z0 = input(prompt);
prompt = 'What is stub charecteristic impeadance? ';
Zs=input(prompt);
prompt = 'What is ZL ';
ZL=input(prompt);
Y0=1/Z0;
YL=1/ZL;
GL=real(YL);
BL=imag(YL);
syms lamda;
if ( GL == Y0)
t = -BL/(2*Y0);
if ( t >= 0 )
d=vpa(atan(t)/(2*pi),4)
R= (GL*(1+t^2))/(GL^2+(BL+Y0*t)^2);
X= ((GL^2)*t - (Y0-BL*t)*(BL+Y0*t))/(Y0*(GL^2 + (BL+Y0*t)^2));
lo = ( atan(Zs/X) / (2*pi));
ls = (-atan(X/Zs) / (2*pi));
while(lo <0)
lo=lo+0.5;
end
while(ls <0)
ls=ls+0.5;
end
lo
ls
else
d=vpa((pi+atan(t))/(2*pi),4)
R= (GL*(1+t^2))/(GL^2+(BL+Y0*t)^2);
X= ((GL^2)*t - (Y0-BL*t)*(BL+Y0*t))/(Y0*(GL^2 + (BL+Y0*t)^2));
lo = ( atan(Zs/X) / (2*pi));
ls = (-atan(X/Zs) / (2*pi));
while(lo <0)
lo=lo+0.5;
end
while(ls <0)
ls=ls+0.5;
end
lo
ls
end
else
t1= (BL + sqrt(GL*((Y0-GL)^2 +BL^2) / Y0)) / (GL-Y0);
t2= (BL - sqrt(GL*((Y0-GL)^2 +BL^2) / Y0)) / (GL-Y0);
if ( t1 >= 0 )
d1=vpa(atan(t1)/(2*pi),4)
R= (GL*(1+t1^2))/(GL^2+(BL+Y0*t1)^2);
X= ((GL^2)*t1 - (Y0-BL*t1)*(BL+Y0*t1))/(Y0*(GL^2 + (BL+Y0*t1)^2));
lo1 = ( atan(Zs/X) / (2*pi));
ls1 = (-atan(X/Zs) / (2*pi));
while(lo1 <0)
lo1=lo1+0.5;
end
while(ls1 <0)
ls1=ls1+0.5;
end
lo1
ls1
else
d1=vpa((pi+atan(t1))/(2*pi),4)
R= (GL*(1+t1^2))/(GL^2+(BL+Y0*t1)^2);
X= ((GL^2)*t1 - (Y0-BL*t1)*(BL+Y0*t1))/(Y0*(GL^2 + (BL+Y0*t1)^2));
lo1 = ( atan(Zs/X) / (2*pi));
ls1 = (-atan(X/Zs) / (2*pi));
while(lo1 <0)
lo1=lo1+0.5;
end
while(ls1 <0)
ls1=ls1+0.5;
end
lo1
ls1
end
if ( t2 >= 0 )
d2=vpa(atan(t2)/(2*pi),4)
R= (GL*(1+t2^2))/(GL^2+(BL+Y0*t2)^2);
X= ((GL^2)*t2 - (Y0-BL*t2)*(BL+Y0*t2))/(Y0*(GL^2 + (BL+Y0*t2)^2));
lo2 = ( atan(Zs/X) / (2*pi));
ls2 = (-atan(X/Zs) / (2*pi));
while(lo2 <0)
lo2=lo2+0.5;
end
while(ls2 <0)
ls2=ls2+0.5;
end
lo2
ls2
else
d2=vpa((pi+atan(t2))/(2*pi),4)
R= (GL*(1+t2^2))/(GL^2+(BL+Y0*t2)^2);
X= ((GL^2)*t2 - (Y0-BL*t2)*(BL+Y0*t2))/(Y0*(GL^2 + (BL+Y0*t2)^2));
lo2 = ( atan(Zs/X) / (2*pi));
ls2 = (-atan(X/Zs) / (2*pi));
while(lo2 <0)
lo2=lo2+0.5;
end
while(ls2 <0)
ls2=ls2+0.5;
end
lo2
ls2
end
end