summaryrefslogtreecommitdiff
path: root/2210/CH3/EX3.18/3_18.sce
diff options
context:
space:
mode:
Diffstat (limited to '2210/CH3/EX3.18/3_18.sce')
-rwxr-xr-x2210/CH3/EX3.18/3_18.sce37
1 files changed, 37 insertions, 0 deletions
diff --git a/2210/CH3/EX3.18/3_18.sce b/2210/CH3/EX3.18/3_18.sce
new file mode 100755
index 000000000..502dff3d4
--- /dev/null
+++ b/2210/CH3/EX3.18/3_18.sce
@@ -0,0 +1,37 @@
+//Chapter 3, Prblem 18,
+clc
+funcprot(0)
+// A = p2z(R,Theta) - Convert from polar to rectangular form.
+// R is a matrix containing the magnitudes
+// Theta is a matrix containing the phase angles (in degrees).
+function [A] = p2z(R,Theta)
+ A = R*exp(%i*%pi*Theta/180);
+endfunction
+
+// [R1, Theta1] = z2p(A1) - Display polar form of complex matrix.
+function [R1, Theta1] = z2p(A1)
+ Theta1 = atan(imag(A1),real(A1))*180/%pi;
+ R1=sqrt(real(A1)^2+imag(A1)^2)
+endfunction
+
+
+//transistor S-parameter
+s11=p2z(0.12,-10)
+s12=p2z(0.002,-78)
+s21=p2z(9.8,160)
+s22=p2z(0.01,-15)
+
+[s11m,s11a]=z2p(s11)
+[s22m,s22a]=z2p(s22)
+[s21m,s21a]=z2p(s21)
+[s12m,s12a]=z2p(s12)
+
+vswr=(1+s11m)/(1-s11m)
+ret_loss=-20*log10(s11m)
+Fig=20*log10(s21m)
+Rig=20*log10(s12m)
+
+printf("(a) Input VSWR = %.2f\n\n",vswr)
+printf("(b) Return loss (dB) = %.2f dB\n\n",ret_loss)
+printf("(c) Forward insertion gain = %.2f dB\n\n",Fig)
+printf("(d) Reverse insertion gain = %.2f dB\n\n",Rig)