diff options
author | priyanka | 2015-06-24 15:03:17 +0530 |
---|---|---|
committer | priyanka | 2015-06-24 15:03:17 +0530 |
commit | b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b (patch) | |
tree | ab291cffc65280e58ac82470ba63fbcca7805165 /2210/CH3 | |
download | Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.gz Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.bz2 Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.zip |
initial commit / add all books
Diffstat (limited to '2210/CH3')
-rwxr-xr-x | 2210/CH3/EX3.1/3_1.sce | 20 | ||||
-rwxr-xr-x | 2210/CH3/EX3.10/3_10.sce | 9 | ||||
-rwxr-xr-x | 2210/CH3/EX3.11/3_11.sce | 28 | ||||
-rwxr-xr-x | 2210/CH3/EX3.13/3_13.sce | 46 | ||||
-rwxr-xr-x | 2210/CH3/EX3.15/3_15.sce | 21 | ||||
-rwxr-xr-x | 2210/CH3/EX3.16/3_16.sce | 21 | ||||
-rwxr-xr-x | 2210/CH3/EX3.17/3_17.sce | 39 | ||||
-rwxr-xr-x | 2210/CH3/EX3.18/3_18.sce | 37 | ||||
-rwxr-xr-x | 2210/CH3/EX3.2/3_2.sce | 38 | ||||
-rwxr-xr-x | 2210/CH3/EX3.3/3_3.sce | 23 | ||||
-rwxr-xr-x | 2210/CH3/EX3.4/3_4.sce | 23 | ||||
-rwxr-xr-x | 2210/CH3/EX3.6/3_6.sce | 59 | ||||
-rwxr-xr-x | 2210/CH3/EX3.8/3_8.sce | 10 | ||||
-rwxr-xr-x | 2210/CH3/EX3.9/3_9.sce | 9 |
14 files changed, 383 insertions, 0 deletions
diff --git a/2210/CH3/EX3.1/3_1.sce b/2210/CH3/EX3.1/3_1.sce new file mode 100755 index 000000000..37686f1ef --- /dev/null +++ b/2210/CH3/EX3.1/3_1.sce @@ -0,0 +1,20 @@ +//Chapter 3, Problem 1, Figure 3.4
+clc
+//https://atoms.scilab.org/toolboxes/microwave
+//Download and install the Microwave toolbox from above link and load it from scilab menubar > Toolboxes > microwave
+
+
+//Plot the smith chart
+uW_display_smith([.2 .5 1 2 5],12);
+Z=[0.7-%i*0.2 0.7+%i*0.3 0.3-%i*0.5 0.3+%i*0.3] //impedances in matrix form
+
+R2=0
+plot2d(real(R2),imag(R2),-1);
+
+for n=1:length(Z)
+ Z1=50*Z(n)
+ G=(Z1-50)/(Z1+50);
+plot2d(real(G), imag(G),-8);
+xtitle("Smith Chart");
+end;
+
diff --git a/2210/CH3/EX3.10/3_10.sce b/2210/CH3/EX3.10/3_10.sce new file mode 100755 index 000000000..20ba49118 --- /dev/null +++ b/2210/CH3/EX3.10/3_10.sce @@ -0,0 +1,9 @@ +//Chapter 3, Problem 10
+clc
+Zlo=0.2 //ratio of Zl/Zo impedance in ohm
+Zo=50 //output impedance in ohm
+
+//calculation of characteristic impedance
+Z0t=Zo*sqrt(Zlo)
+
+printf("Characteristic impedance, Z0t = %d ohm",Z0t)
diff --git a/2210/CH3/EX3.11/3_11.sce b/2210/CH3/EX3.11/3_11.sce new file mode 100755 index 000000000..0e808c143 --- /dev/null +++ b/2210/CH3/EX3.11/3_11.sce @@ -0,0 +1,28 @@ +//Chapter 3, Problem 11, Figure 3.16(a), 3.18
+clc
+Zs=50+%i*0 //impedance in ohm
+Zl=100+%i*0 //impedance in ohm
+
+//using one quarter wave transformer in the circuit of figure 3.16(a)
+Z0=sqrt(Zs*Zl)
+
+//Use two quarter-wave transformers as in Figure 3.18
+Z0t=sqrt(Zl/Zs)
+Z0t2=60
+Z0t1=Z0t2*Z0t
+
+//using table 3.3
+x=[0.6,0.8,1.0,1.2,1.4]
+y=[-13.83,-19.28,-60,-19.28,-13.83]
+clf;
+x1=[0.6,0.8,1.0,1.2,1.4]
+y1=[-18.81,-32.09,-38.69,-32.09,-18.81]
+plot(x,y,".r")
+plot(x1,y1,".b")
+legend("one h/4","Two h/4")
+
+xtitle("reflection coefficient vs frequency","frequency (GHz)","Reflection coefficient (dB)");
+printf("(a) Matching network using one λ/4 transformer,\n\t Z0 = %.2f ohm\n\n",Z0)
+printf("(b) Matching network using two λ/4 transformers,\n Ratio of Z0t1 and Z0t2 = %.3f\n",Z0t)
+printf("If I choose a value of 60 ohm for Z0t2, then Z0t1 = %.2f ohm\n\n",Z0t1)
+
diff --git a/2210/CH3/EX3.13/3_13.sce b/2210/CH3/EX3.13/3_13.sce new file mode 100755 index 000000000..055c1b289 --- /dev/null +++ b/2210/CH3/EX3.13/3_13.sce @@ -0,0 +1,46 @@ +//Chapter 3, Problem 13
+clc
+
+//https://atoms.scilab.org/toolboxes/microwave
+//Download and install the Microwave toolbox from above link and load it from scilab menubar > Toolboxes > microwave
+
+funcprot(0)
+// [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
+
+zin=100 //input resistance in ohm
+zo=50 //amplifier input resistance in ohm
+cl=5e-12 //capacitance in farad
+f=10^9 //frequency in hertz
+d=1+(%i*2.3) //point C
+h=0-(%i*2.3) //point E
+
+//Calculation
+Yo=1/zo
+Yl=(1/zin)+(%i*2*%pi*f*cl)
+Y=Yl/Yo
+
+//Plot the smith chart
+uW_display_smith([.2 .5 1 2 5],12);
+Y1=50*Y;
+R=(Y1-50)/(Y1+50);
+R2=0
+[Rm,Ra]=z2p(R)
+plot2d(real(R),imag(R),-8);
+plot2d(real(R2),imag(R2),-1);
+y=[d h]
+for n=1:length(y)
+ y1=50*y(n)
+ R1=(y1-50)/(y1+50);
+plot2d(real(R1), imag(R1),-8);
+end;
+
+//Plot a VSWR circle of radius 0.667
+x=linspace(0,2*%pi,200);
+plot2d(Rm*cos(x),Rm*sin(x))
+xtitle("Smith chart")
+
+printf("Yl/Yo = %.1f + j %.2f\n\n",real(Y),imag(Y))
diff --git a/2210/CH3/EX3.15/3_15.sce b/2210/CH3/EX3.15/3_15.sce new file mode 100755 index 000000000..00cd00728 --- /dev/null +++ b/2210/CH3/EX3.15/3_15.sce @@ -0,0 +1,21 @@ +//Chapter 3, Prblem 15, figure 3.30
+clc
+//from figure 3.30
+zo=50 //in ohm
+zl=50 //in ohm
+
+//calculating the S parameter
+z1=zo+zl
+s11=(z1-zo)/(z1+zo)
+z2=zo+zl
+s22=(z2-zo)/(z2+zo)
+s21=(2*zl)/(50+zo+zl)
+s12=(2*zl)/(50+zo+zl)
+
+s=[s11 s12;s21 s22]
+
+printf("s11 (magnitude) = %.3f \n\t(angle) = 0 degree\n\n",s11)
+printf("s12 (magnitude) = %.3f \n\t(angle) = 0 degree\n\n",s12)
+printf("s21 (magnitude) = %.3f \n\t(angle) = 0 degree\n\n",s21)
+printf("s22 (magnitude) = %.3f \n\t(angle) = 0 degree\n\n",s22)
+disp(s,"S = ")
diff --git a/2210/CH3/EX3.16/3_16.sce b/2210/CH3/EX3.16/3_16.sce new file mode 100755 index 000000000..2ed828eab --- /dev/null +++ b/2210/CH3/EX3.16/3_16.sce @@ -0,0 +1,21 @@ +//Chapter 3, Prblem 16, figure 3.32
+clc
+//from figure 3.32
+zo=50 //in ohm
+zl=50 //in ohm
+
+//calculating the S parameter
+z1=(zo*zl)/(zo+zl)
+s11=(z1-zo)/(z1+zo)
+z2=(zo*zl)/(zo+zl)
+s22=(z2-zo)/(z2+zo)
+s21=(2*z1)/(50+z1)
+s12=(2*z2)/(50+z2)
+
+s=[s11 s12;s21 s22]
+
+printf("s11 (magnitude) = %.3f \n\t(angle) = 180 degree\n\n",-s11)
+printf("s12 (magnitude) = %.3f \n\t(angle) = 0 degree\n\n",s12)
+printf("s21 (magnitude) = %.3f \n\t(angle) = 0 degree\n\n",s21)
+printf("s22 (magnitude) = %.3f \n\t(angle) = 180 degree\n\n",-s22)
+disp(s,"S (magnitude) = ")
diff --git a/2210/CH3/EX3.17/3_17.sce b/2210/CH3/EX3.17/3_17.sce new file mode 100755 index 000000000..e8b1245ae --- /dev/null +++ b/2210/CH3/EX3.17/3_17.sce @@ -0,0 +1,39 @@ +//Chapter 3, Prblem 17, figure 3.34
+clc
+funcprot(0)
+// [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
+
+
+//from figure 3.34
+zo=50 //in ohm
+zl=50 //in ohm
+r1=30
+zai=%i*20
+za=(r1*zo)/(r1+zo)
+z1=za+zai
+s11=(z1-zo)/(z1+zo)
+z2=(zo+zai)*r1/(zo+zai+r1)
+s22=(z2-zo)/(z2+zo)
+s21=za*2/(za+(zo+zai))
+s12=zo*0.75/(za+zo+zai)
+
+
+[s11m,s11a]=z2p(s11)
+[s22m,s22a]=z2p(s22)
+[s21m,s21a]=z2p(s21)
+[s12m,s12a]=z2p(s12)
+
+ret_loss=-20*log10(s11m)
+ins_loss=-20*log10(s21m)
+
+printf("(a) S parameters is , \n")
+printf("s11 (magnitude) = %.3f \n\t(angle) = %.2f degree\n\n",s11m,s11a)
+printf("s12 (magnitude) = %.3f \n\t(angle) = %.2f degree\n\n",s12m,s12a)
+printf("s21 (magnitude) = %.3f \n\t(angle) = %.2f degree\n\n",s21m,s21a)
+printf("s22 (magnitude) = %.3f \n\t(angle) = %.2f degree\n\n",s22m,s22a)
+printf("(b) Return loss = %.3f dB\n\n",ret_loss)
+printf("(c) Insertion loss = %.3f dB\n\n",ins_loss)
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)
diff --git a/2210/CH3/EX3.2/3_2.sce b/2210/CH3/EX3.2/3_2.sce new file mode 100755 index 000000000..81b888834 --- /dev/null +++ b/2210/CH3/EX3.2/3_2.sce @@ -0,0 +1,38 @@ +//Chapter 3, Problem 2
+clc
+//https://atoms.scilab.org/toolboxes/microwave
+//Download and install the Microwave toolbox from above link and load it from scilab menubar > Toolboxes > microwave
+
+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
+
+//Plot the smith chart
+uW_display_smith([.2 .5 1 2 5],12);
+Z=0.8-%i*1.6; //impedance
+Z1=50*Z; //50 = characteristic impedance
+[Zm,Za]=z2p(Z);
+G=(Z1-50)/(Z1+50); //reflection coefficient
+Ym=1/Zm //admittance (magnitude)
+Ya=Za*(-1) //admittance (angle)
+Y=p2z(Ym,Ya)
+Y1=50*Y;
+R=(Y1-50)/(Y1+50);
+R2=0
+plot2d(real(R2),imag(R2),-1);
+
+plot2d(real(G),imag(G),-8);
+plot2d(real(R),imag(R),-8);
+xtitle("Smith Chart");
+printf("Admittance value, Y = %.2f + j%.1f",real(Y),imag(Y));
diff --git a/2210/CH3/EX3.3/3_3.sce b/2210/CH3/EX3.3/3_3.sce new file mode 100755 index 000000000..78c60f5c5 --- /dev/null +++ b/2210/CH3/EX3.3/3_3.sce @@ -0,0 +1,23 @@ +//Chapter 3, Problem 3
+clc
+//https://atoms.scilab.org/toolboxes/microwave
+//Download and install the Microwave toolbox from above link and load it from scilab menubar > Toolboxes > microwave
+
+//Plot the smith chart
+uW_display_smith([.2 .5 1 2 5],12);
+r=0.667 //radius of VSWR circle
+Z=0.25-%i*0.5; //impedance
+Z1=50*Z; //50 = characteristic impedance
+G=(Z1-50)/(Z1+50); //reflection coefficient
+R2=0
+plot2d(real(R2),imag(R2),-1);
+plot2d(real(G),imag(G),-8);
+
+//Plot a VSWR circle of radius 0.667
+x=linspace(0,2*%pi,200);
+plot2d(r*cos(x),r*sin(x))
+xtitle("Smith Chart");
+
+
+printf("From smith chart, The answer is %.3f (magnitude) and -124 degree (angle)",r)
+disp("This is shown as point C in Figure 3.11.")
diff --git a/2210/CH3/EX3.4/3_4.sce b/2210/CH3/EX3.4/3_4.sce new file mode 100755 index 000000000..fac6a4d4b --- /dev/null +++ b/2210/CH3/EX3.4/3_4.sce @@ -0,0 +1,23 @@ +//Chapter 3, Problem 4
+clc
+//https://atoms.scilab.org/toolboxes/microwave
+//Download and install the Microwave toolbox from above link and load it from scilab menubar > Toolboxes > microwave
+
+//Plot the smith chart
+uW_display_smith([.2 .5 1 2 5],12);
+r=0.667 //radius of VSWR circle
+Z=0.21+%i*0.21; //impedance
+Z1=50*Z; //50 = characteristic impedance
+G=(Z1-50)/(Z1+50); //reflection coefficient
+R2=0
+plot2d(real(R2),imag(R2),-1);
+plot2d(real(G),imag(G),-8);
+
+//Plot a VSWR circle of radius 0.667
+x=linspace(0,2*%pi,200);
+plot2d(r*cos(x),r*sin(x))
+xtitle("Smith Chart");
+
+
+printf("From smith chart, The answer is %.2f + j%.2f",real(Z),imag(Z))
+disp("This is shown as point E in Figure 3.11.")
diff --git a/2210/CH3/EX3.6/3_6.sce b/2210/CH3/EX3.6/3_6.sce new file mode 100755 index 000000000..f95c6c20c --- /dev/null +++ b/2210/CH3/EX3.6/3_6.sce @@ -0,0 +1,59 @@ +//Chapter 3, Problem 6
+clc
+//https://atoms.scilab.org/toolboxes/microwave
+//Download and install the Microwave toolbox from above link and load it from scilab menubar > Toolboxes > microwave
+
+funcprot(0)
+
+// [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
+
+function Zin = zin(d)
+ B=2*%pi*d
+ Zin=Zo*((Zl+(%i*Zo*tan(B)))/(Zo+(%i*Zl*tan(B))))
+endfunction
+
+Zo=50 //characteristic impedance
+Zl=40-%i*80 //load impedance
+//line
+d1=0.096
+d2=0.173
+d3=0.206
+
+refl=(Zl-Zo)/(Zl+Zo) //reflection coefficient
+[reflm,refla]=z2p(refl)
+SWR=(1+reflm)/(1-reflm) //standing wave ratio
+Zin1=zin(d1)
+Zin2=zin(d2)
+Zin3=zin(d3)
+////load impedance is expressed in normalised form
+a=Zl/Zo
+d=0.25-%i*0.5
+f=0.2+%i*0
+h=0.2+%i*0.2
+j=0.25-%i*0.5
+
+
+//Plot the smith chart
+uW_display_smith([.2 .5 1 2 5],12);
+Z=[a d f h j]
+for n=1:length(Z)
+ Z1=50*Z(n)
+ G=(Z1-50)/(Z1+50);
+plot2d(real(G), imag(G),-8);
+end;
+R2=0
+plot2d(real(R2),imag(R2),-1);
+
+//Plot a VSWR circle of radius 0.667
+x=linspace(0,2*%pi,200);
+plot2d(0.66*cos(x),0.66*sin(x))
+xtitle("Smith Chart");
+
+printf("The input impedance Zin of the terminated line \n\n")
+printf("(a) 0.096h = %.2f %.2fj\n\n",real(Zin1),imag(Zin1))
+printf("(a) 0.173h = %.2f + %.2fj\n\n",real(Zin2),imag(Zin2))
+printf("(a) 0.206h = %.2f + %.2fj\n\n",real(Zin3),imag(Zin3))
diff --git a/2210/CH3/EX3.8/3_8.sce b/2210/CH3/EX3.8/3_8.sce new file mode 100755 index 000000000..877320269 --- /dev/null +++ b/2210/CH3/EX3.8/3_8.sce @@ -0,0 +1,10 @@ +//Chapter 3, Problem 8
+clc
+
+j=0.25+(%i*0.5) //Normalised impedance from smith chart
+Zo=50 //Characteristic impedance
+
+//calculating line impedance at point J in Figure 3.15
+Zl=j*Zo
+
+printf("Line impedance = %.1f + j%d",real(Zl),imag(Zl))
diff --git a/2210/CH3/EX3.9/3_9.sce b/2210/CH3/EX3.9/3_9.sce new file mode 100755 index 000000000..3eeec0c60 --- /dev/null +++ b/2210/CH3/EX3.9/3_9.sce @@ -0,0 +1,9 @@ +//Chapter 3, Problem 9
+clc
+Z0=50 //characteristic impedance in ohm
+Zl0=5 //ratio of Z/Z0
+
+//calculation
+Z0t=sqrt(Zl0)
+Z0t1=Z0*Z0t
+printf("Impedance = %.2f ohm",Z0t1)
|