summaryrefslogtreecommitdiff
path: root/339
diff options
context:
space:
mode:
Diffstat (limited to '339')
-rwxr-xr-x339/CH1/EX1.4/ex1_4.sce31
-rwxr-xr-x339/CH10/EX10.2/ex10_2.sce58
-rwxr-xr-x339/CH6/EX6.1/ex6_1.sce55
-rwxr-xr-x339/CH6/EX6.4/ex6_4.sce37
-rwxr-xr-x339/CH9/EX9.13/ex9_13.sce95
-rwxr-xr-x339/CH9/EX9.14/ex9_14.sce128
-rwxr-xr-x339/CH9/EX9.15/ex9_15.sce258
7 files changed, 333 insertions, 329 deletions
diff --git a/339/CH1/EX1.4/ex1_4.sce b/339/CH1/EX1.4/ex1_4.sce
index 58784b047..8386964c0 100755
--- a/339/CH1/EX1.4/ex1_4.sce
+++ b/339/CH1/EX1.4/ex1_4.sce
@@ -1,16 +1,17 @@
-f=10^6:10^7:10^10;
-rs=(4.8*10^-6).*sqrt(f);
-re=(33.9*10^12) ./f;
-c=47*10^-12;
-w=2*%pi.*f;
-l=2*1.25*10^-2;
-a=2.032*10^-4;
-temp=log(2*l/a)/log(%e);
-lex=mu0*l*(temp-1)/(2*%pi); //external inductance
-z=1 ./(1 ./re +w*c*%i)+rs+w.*lex*%i; // impedance of frequency dependent capacitor
-zideal=1 ./(w*c*%i); //impedance of an ideal capacitor
-plot2d("gll",f,abs(z));
-plot2d(f,abs(zideal));
-title("Frequency responce of a high frequency capacitor");
-xlabel('Frequency (f) in Hz');
+f=10^6:10^7:10^10;
+mu0=4*%pi*10^-7;
+rs=(4.8*10^-6).*sqrt(f);
+re=(33.9*10^12) ./f;
+c=47*10^-12;
+w=2*%pi.*f;
+l=2*1.25*10^-2;
+a=2.032*10^-4;
+temp=log(2*l/a)/log(%e);
+lex=mu0*l*(temp-1)/(2*%pi); //external inductance
+z=1 ./(1 ./re +w*c*%i)+rs+w.*lex*%i; // impedance of frequency dependent capacitor
+zideal=1 ./(w*c*%i); //impedance of an ideal capacitor
+plot2d("gll",f,abs(z));
+plot2d(f,abs(zideal));
+title("Frequency responce of a high frequency capacitor");
+xlabel('Frequency (f) in Hz');
ylabel('Absolute impedance (|Z|) in ohms'); \ No newline at end of file
diff --git a/339/CH10/EX10.2/ex10_2.sce b/339/CH10/EX10.2/ex10_2.sce
index 97543916e..26a683c16 100755
--- a/339/CH10/EX10.2/ex10_2.sce
+++ b/339/CH10/EX10.2/ex10_2.sce
@@ -1,30 +1,30 @@
-stacksize("max");
-//define crystal parameters
-Lq=0.1;
-Rq=25;
-Cq=0.3*10^-12;
-C0=1*10^-12;
-
-//find series resonance frequency
-ws0=1/sqrt(Lq*Cq);
-disp(ws0);
-ws=ws0*(1+Rq^2/2*C0/Lq);
-fs=ws/2/%pi
-
-//find parallel resonance frequency
-wp0=sqrt((Cq+C0)/(Lq*Cq*C0));
-wp=wp0*(1-Rq^2/2*C0/Lq);
-fp=wp/2/%pi
-
-//define frequency range for this plot
-f=(0.9:0.00001:1.1)*1e6;
-w=2*%pi*f;
-
-//find abmittance of the resonator
-Y=%i.*w*C0+1./(Rq+%i*(w*Lq-1./(w*Cq)));
-
-plot(f/1e6,abs(imag(Y)));
-mtlb_axis([0.9 1.1 1e-10 1e-1]);
-title('Admittance of the quartz crystal resonator');
-xlabel('Frequency {\itf}, MHz');
+stacksize("max");
+//define crystal parameters
+Lq=0.1;
+Rq=25;
+Cq=0.3*10^-12;
+C0=1*10^-12;
+
+//find series resonance frequency
+ws0=1/sqrt(Lq*Cq);
+disp(ws0);
+ws=ws0*(1+Rq^2/2*C0/Lq);
+fs=ws/2/%pi
+
+//find parallel resonance frequency
+wp0=sqrt((Cq+C0)/(Lq*Cq*C0));
+wp=wp0*(1-Rq^2/2*C0/Lq);
+fp=wp/2/%pi
+
+//define frequency range for this plot
+f=(0.9:0.00001:1.1)*1e6;
+w=2*%pi*f;
+
+//find abmittance of the resonator
+Y=%i.*w*C0+1.0./(Rq+%i*(w*Lq-1.0./(w*Cq)));
+
+plot(f/1e6,abs(imag(Y)));
+mtlb_axis([0.9 1.1 1e-10 1e-1]);
+title('Admittance of the quartz crystal resonator');
+xlabel('Frequency {\itf}, MHz');
ylabel('Susceptance |B|, \Omega'); \ No newline at end of file
diff --git a/339/CH6/EX6.1/ex6_1.sce b/339/CH6/EX6.1/ex6_1.sce
index b44461fa8..cf22485da 100755
--- a/339/CH6/EX6.1/ex6_1.sce
+++ b/339/CH6/EX6.1/ex6_1.sce
@@ -1,27 +1,30 @@
-//define physical constants
-q=1.60218e-19;
-k=1.38066e-23;
-
-// define material properties
-Nc_300=[1.04e19 2.8e19 4.7e17];
-Nv_300=[6e18 1.04e19 7e18];
-mu_n= [3900 1500 8500];
-mu_p= [1900 450 400];
-Wg= [0.66 1.12 1.424];
-
-T0=273;
-T=-50:250; // temperature range in centigrade
-
-sigma=zeros([3 length(T)]);
-
-for s=1:3 //loop through all semi conductor materials
- Nc=Nc_300(s)*((T+T0)/300).^(3/2);
- Nv=Nv_300(s)*((T+T0)/300).^(3/2);
-sigma=[q*sqrt(Nc.*Nv).*(exp(-Wg(s)./(2*k*(T+T0)/q)))*(mu_n(s)+mu_p(s))];
-end;
-
-plot(T,sigma(1),T,sigma(2),T,sigma(3));
-legend('Ge','Si','GaAs',2);
-title('Conductivity of semiconductor at different temperatures');
-xlabel('Temperature, {\circ}C');
+//define physical constants
+q=1.60218e-19;
+k=1.38066e-23;
+
+// define material properties
+Nc_300=[1.04e19 2.8e19 4.7e17];
+Nv_300=[6e18 1.04e19 7e18];
+mu_n= [3900 1500 8500];
+mu_p= [1900 450 400];
+Wg= [0.66 1.12 1.424];
+
+T0=273;
+T=-50:250; // temperature range in centigrade
+
+sigma=zeros(3, length(T));
+
+for s=1:3 //loop through all semi conductor materials
+ Nc=Nc_300(s)*((T+T0)/300).^(3/2);
+ Nv=Nv_300(s)*((T+T0)/300).^(3/2);
+sigma(s,:)=[q*sqrt(Nc.*Nv).*(exp(-Wg(s)./(2*k*(T+T0)/q)))*(mu_n(s)+mu_p(s))];
+end;
+
+plot(T,sigma(1,:),'r');
+mtlb_hold on
+plot(T,sigma(2,:),'b')
+plot(T,sigma(3,:),'g')
+legend('Ge','Si','GaAs',2);
+title('Conductivity of semiconductor at different temperatures');
+xlabel('Temperature, {\circ}C');
ylabel('Conductivity \sigma, \Omega^{-1}cm^{-1}'); \ No newline at end of file
diff --git a/339/CH6/EX6.4/ex6_4.sce b/339/CH6/EX6.4/ex6_4.sce
index 437073e4f..c0d37eaed 100755
--- a/339/CH6/EX6.4/ex6_4.sce
+++ b/339/CH6/EX6.4/ex6_4.sce
@@ -1,18 +1,21 @@
-//doping concentrations
-Nc=2.8*10^19;
-Nd=1*10^16;
-term=Nc/Nd;
-k=1.38*10^-23; //Boltzman's constant
-q=1.6*10^-19; //charge
-Vc=(k*T)*log(term)/q;
-Vm=5.1; //workfunction
-X=4.05; //affinity
-Vd=(Vm-X)-Vc; //Barrier Voltage
-Epsilon=11.9*8.854*10^-12;
-ds=sqrt((2*Epsilon*Vd)/(q*Nd));
-A=1*10^-4; //cross-sectional area
-Cj=(A*Epsilon)/(ds); //junction capacitance
-disp("Volts",Vc,"Conduction Band potential");
-disp("Volts",Vd,"Built in Barrier Voltage");
-disp("metre",ds,"Space Charge Width");
+clc
+clear
+T=300;
+//doping concentrations
+Nc=2.8*10^19;
+Nd=1*10^16;
+term=Nc/Nd;
+k=1.38*10^-23; //Boltzman's constant
+q=1.6*10^-19; //charge
+Vc=(k*T)*log(term)/q;
+Vm=5.1; //workfunction
+X=4.05; //affinity
+Vd=(Vm-X)-Vc; //Barrier Voltage
+Epsilon=11.9*8.854*10^-12;
+ds=sqrt((2*Epsilon*Vd)/(q*Nd));
+A=1*10^-4; //cross-sectional area
+Cj=(A*Epsilon)/(ds); //junction capacitance
+disp("Volts",Vc,"Conduction Band potential");
+disp("Volts",Vd,"Built in Barrier Voltage");
+disp("metre",ds,"Space Charge Width");
disp("Farads",Cj,"Junction Capacitance"); \ No newline at end of file
diff --git a/339/CH9/EX9.13/ex9_13.sce b/339/CH9/EX9.13/ex9_13.sce
index 4ef7d55bd..c9b73814a 100755
--- a/339/CH9/EX9.13/ex9_13.sce
+++ b/339/CH9/EX9.13/ex9_13.sce
@@ -1,50 +1,45 @@
-//define the S-parameters of the transistor
-s11=0.3*exp(%i*(+30)/180*%pi);
-s12=0.2*exp(%i*(-60)/180*%pi);
-s21=2.5*exp(%i*(-80)/180*%pi);
-s22=0.2*exp(%i*(-15)/180*%pi);
-
-K=1.18
-
-//find the maximum gain
-Gmax=abs(s21/s12)*(K-sqrt(K^2-1));
-Gmax_dB=10*log10(Gmax)
-
-//specify the target gain
-G_goal_dB=8; //would like to build an amplifier with 8dB gain
-G_goal=10^(G_goal_dB/10); //convert from dB to normal units
-
-//find constant operating power gain circles
-go=G_goal/abs(s21)^2;
-
-//find the center of the constant operating power gain circle
-dgo=go*conj(s22-conj(s11))/(1+go*(abs(s22)^2));
-
-
-//find the radius of the circle
-rgo1=sqrt(1-2*K*go*abs(s12*s21)+go^2*abs(s12*s21)^2);
-rgo=rgo1/abs(1+go*(abs(s22)^2));
-
-//plot a circle in the Smith Chart
-a=(0:360)/180*%pi;
-
-set(gca(),"auto_clear","off");
-plot(real(dgo)+rgo*cos(a),imag(dgo)+rgo*sin(a),'r','linewidth',2);
-
-//choose the load reflection coefficient
-zL=1-%i*0.53
-GL=(zL-1)/(zL+1);
-
-plot(real(GL),imag(GL),'bo');
-
-[Ro,Theta]=polar(atan(imag(Gs),real(Gs)));
-Gin=s11+s12*s21*GL/(1-s22*GL);
-Gs=conj(Gin);
-Gs_abs=abs(Gs)
-Gs_angle=(Theta/%pi)*180;
-
-zs=(1+Gs)/(1-Gs);
-
-
-
-
+//define the S-parameters of the transistor
+s11=0.3*exp(%i*(+30)/180*%pi);
+s12=0.2*exp(%i*(-60)/180*%pi);
+s21=2.5*exp(%i*(-80)/180*%pi);
+s22=0.2*exp(%i*(-15)/180*%pi);
+
+K=1.18
+
+//find the maximum gain
+Gmax=abs(s21/s12)*(K-sqrt(K^2-1));
+Gmax_dB=10*log10(Gmax)
+
+//specify the target gain
+G_goal_dB=8; //would like to build an amplifier with 8dB gain
+G_goal=10^(G_goal_dB/10); //convert from dB to normal units
+
+//find constant operating power gain circles
+go=G_goal/abs(s21)^2;
+
+//find the center of the constant operating power gain circle
+dgo=go*conj(s22-conj(s11))/(1+go*(abs(s22)^2));
+
+
+//find the radius of the circle
+rgo1=sqrt(1-2*K*go*abs(s12*s21)+go^2*abs(s12*s21)^2);
+rgo=rgo1/abs(1+go*(abs(s22)^2));
+
+//plot a circle in the Smith Chart
+a=(0:360)/180*%pi;
+
+mtlb_hold on
+plot(real(dgo)+rgo*cos(a),imag(dgo)+rgo*sin(a),'r','linewidth',2);
+
+//choose the load reflection coefficient
+zL=1-%i*0.53
+GL=(zL-1)/(zL+1);
+
+plot(real(GL),imag(GL),'bo');
+Gin=s11+s12*s21*GL/(1-s22*GL);
+Gs=conj(Gin);
+Gs_abs=abs(Gs)
+[Ro,Theta]=polar(atan(imag(Gs),real(Gs)));
+Gs_angle=(Theta/%pi)*180;
+
+zs=(1+Gs)/(1-Gs); \ No newline at end of file
diff --git a/339/CH9/EX9.14/ex9_14.sce b/339/CH9/EX9.14/ex9_14.sce
index 0b6e65f6a..ae26754a0 100755
--- a/339/CH9/EX9.14/ex9_14.sce
+++ b/339/CH9/EX9.14/ex9_14.sce
@@ -1,65 +1,65 @@
-global Z0;
-Z0=50;
-
-//define the S-parameters of the transistor
-s11=0.3*exp(%i*(+30)/180*%pi);
-s12=0.2*exp(%i*(-60)/180*%pi);
-s21=2.5*exp(%i*(-80)/180*%pi);
-s22=0.2*exp(%i*(-15)/180*%pi);
-
-//pick the noise parameters of the transistor
-Fmin_dB=1.5
-Fmin=10^(Fmin_dB/10);
-Rn=4;
-Gopt=0.5*exp(%i*45/180*%pi);
-
-//compute a noise circle
-Fk_dB=1.6;
-Fk=10^(Fk_dB/10);
-
-
-Qk=abs(1+Gopt)^2*(Fk-Fmin)/(4*Rn/Z0) //noise circle parameter
-dfk=Gopt/(1+Qk); //circle center location
-rfk=sqrt((1-abs(Gopt)^2)*Qk+Qk^2)/(1+Qk) //circle radius
-
-
-//plot a noise circle
-a=[0:360]/180*%pi;
-set(gca(),"auto_clear","off");
-plot(real(dfk)+rfk*cos(a),imag(dfk)+rfk*sin(a),'b','linewidth',2);
-
-// plot optimal reflection coefficient
-plot(real(Gopt),imag(Gopt),'bo');
-
-
-//specify the desired gain
-G_goal_dB=8;
-G_goal=10^(G_goal_dB/10);
-
-//find the constant operating power gain circles
-go=G_goal/abs(s21)^2; // normalized the gain
-dgo=go*conj(s22-conj(s11))/(1+go*(abs(s22)^2)); //center
-
-rgo=sqrt(1-2*K*go*abs(s12*s21)+go^2*abs(s12*s21)^2);
-rgo=rgo/abs(1+go*(abs(s22)^2));
-
-//map a constant gain circle into the Gs plane
-rgs=rgo*abs(s12*s21/(abs(1-s22*dgo)^2-rgo^2*abs(s22)^2));
-dgs=((1-s22*dgo)*conj(s11-dgo)-rgo^2*s22)/(abs(1-s22*dgo)^2-rgo^2*abs(s22)^2);
-
-//plot a constant gain circle in the Smith Chart
-set(gca(),"auto_clear","off");
-plot(real(dgs)+rgs*cos(a),imag(dgs)+rgs*sin(a),'r','linewidth',2);
-
-
-
-//choose a source reflection coefficient Gs
-Gs=dgs+%i*rgs;
-plot(real(Gs), imag(Gs), 'ro');
-//text(real(Gs)-0.05,imag(Gs)+0.08,'\bf\Gamma_S');
-
-//find the actual noise figure
-F=Fmin+4*Rn/Z0*abs(Gs-Gopt)^2/(1-abs(Gs)^2)/abs(1+Gopt)^2;
-
-//print out the actual noise figure
+global Z0;
+Z0=50;
+
+//define the S-parameters of the transistor
+s11=0.3*exp(%i*(+30)/180*%pi);
+s12=0.2*exp(%i*(-60)/180*%pi);
+s21=2.5*exp(%i*(-80)/180*%pi);
+s22=0.2*exp(%i*(-15)/180*%pi);
+
+//pick the noise parameters of the transistor
+Fmin_dB=1.5
+Fmin=10^(Fmin_dB/10);
+Rn=4;
+Gopt=0.5*exp(%i*45/180*%pi);
+
+//compute a noise circle
+Fk_dB=1.6;
+Fk=10^(Fk_dB/10);
+
+
+Qk=abs(1+Gopt)^2*(Fk-Fmin)/(4*Rn/Z0) //noise circle parameter
+dfk=Gopt/(1+Qk); //circle center location
+rfk=sqrt((1-abs(Gopt)^2)*Qk+Qk^2)/(1+Qk) //circle radius
+
+
+//plot a noise circle
+a=[0:360]/180*%pi;
+mtlb_hold on
+plot(real(dfk)+rfk*cos(a),imag(dfk)+rfk*sin(a),'b','linewidth',2);
+
+// plot optimal reflection coefficient
+plot(real(Gopt),imag(Gopt),'bo');
+
+
+//specify the desired gain
+G_goal_dB=8;
+G_goal=10^(G_goal_dB/10);
+K = 1.18;
+//find the constant operating power gain circles
+go=G_goal/abs(s21)^2; // normalized the gain
+dgo=go*conj(s22-conj(s11))/(1+go*(abs(s22)^2)); //center
+
+rgo=sqrt(1-2*K*go*abs(s12*s21)+go^2*abs(s12*s21)^2);
+rgo=rgo/abs(1+go*(abs(s22)^2));
+
+//map a constant gain circle into the Gs plane
+rgs=rgo*abs(s12*s21/(abs(1-s22*dgo)^2-rgo^2*abs(s22)^2));
+dgs=((1-s22*dgo)*conj(s11-dgo)-rgo^2*s22)/(abs(1-s22*dgo)^2-rgo^2*abs(s22)^2);
+
+//plot a constant gain circle in the Smith Chart
+mtlb_hold on
+plot(real(dgs)+rgs*cos(a),imag(dgs)+rgs*sin(a),'r','linewidth',2);
+
+
+
+//choose a source reflection coefficient Gs
+Gs=dgs+%i*rgs;
+plot(real(Gs), imag(Gs), 'ro');
+//text(real(Gs)-0.05,imag(Gs)+0.08,'\bf\Gamma_S');
+
+//find the actual noise figure
+F=Fmin+4*Rn/Z0*abs(Gs-Gopt)^2/(1-abs(Gs)^2)/abs(1+Gopt)^2;
+
+//print out the actual noise figure
Actual_F_dB=10*log10(F) \ No newline at end of file
diff --git a/339/CH9/EX9.15/ex9_15.sce b/339/CH9/EX9.15/ex9_15.sce
index b6f672834..18b33257b 100755
--- a/339/CH9/EX9.15/ex9_15.sce
+++ b/339/CH9/EX9.15/ex9_15.sce
@@ -1,129 +1,131 @@
-global Z0;
-Z0=50;
-
-//define the S-parameters of the transistor
-s11=0.3*exp(%i*(+30)/180*%pi);
-s12=0.2*exp(%i*(-60)/180*%pi);
-s21=2.5*exp(%i*(-80)/180*%pi);
-s22=0.2*exp(%i*(-15)/180*%pi);
-
-//noise parameters of the transistor
-Fmin_dB=1.5
-Fmin=10^(Fmin_dB/10);
-Rn=4;
-Gopt=0.5*exp(%i*45/180*%pi);
-
-
-//compute a noise circle
-Fk_dB=1.6;//desired noise performance
-Fk=10^(Fk_dB/10);
-
-Qk=abs(1+Gopt)^2*(Fk-Fmin)/(4*Rn/Z0); //noise circle parameter
-dfk=Gopt/(1+Qk); //circle center location
-rfk=sqrt((1-abs(Gopt)^2)*Qk+Qk^2)/(1+Qk); //circle radius
-
-
-//plot a noise circle
-a=[0:360]/180*%pi;
-set(gca(),"auto_clear","off");
-plot(real(dfk)+rfk*cos(a),imag(dfk)+rfk*sin(a),'b','linewidth',2);
-
-//specify the goal gain
-G_goal_dB=8;
-G_goal=10^(G_goal_dB/10);
-
-
-//find constant operating power gain circles
-go=G_goal/abs(s21)^2; //normalized gain
-dgo=go*conj(s22-delta*conj(s11))/(1+go*(abs(s22)^2)); //center
-
-rgo=sqrt(1-2*K*go*abs(s12*s21)+go^2*abs(s12*s21)^2);
-rgo=rgo/abs(1+go*(abs(s22)^2)); //radius
-
-//map a constant gain circle into the Gs plane
-rgs=rgo*abs(s12*s21/(abs(1-s22*dgo)^2-rgo^2*abs(s22)^2));
-dgs=((1-s22*dgo)*conj(s11-delta*dgo)-rgo^2*s22)/(abs(1-s22*dgo)^2-rgo^2*abs(s22)^2);
-
-//plot constant gain circle in the Smith Chart
-set(gca(),"auto_clear","off");
-plot(real(dgs)+rgs*cos(a),imag(dgs)+rgs*sin(a),'r','linewidth',2);
-
-
-//choose a source reflection coefficient Gs
-Gs=dgs+%i*rgs;
-
-//find the corresponding GL
-GL=(s11-conj(Gs))/(delta-s22*conj(Gs));
-
-//find the actual noise figure
-F=Fmin+4*Rn/Z0*abs(Gs-Gopt)^2/(1-abs(Gs)^2)/abs(1+Gopt)^2;
-
-//% print out the actual noise figure
-Actual_F_dB=10*log10(F)
-
-//find the input and output reflection coefficients
-Gin=s11+s12*s21*GL/(1-s22*GL);
-Gout=s22+s12*s21*Gs/(1-s11*Gs);
-
-
-//find the VSWRin and VSWRout
-Gimn=abs((Gin-conj(Gs))/(1-Gin*Gs));
-Gomn=abs((Gout-conj(GL))/(1-Gout*GL));
-
-VSWRin=(1+Gimn)/(1-Gimn); //VSWRin should be unity since we used the constant operating gain approach
-VSWRout=(1+Gomn)/(1-Gomn);
-
-//specify the desired VSWRin
-VSWRin=1.5;
-
-//find parameters for constant VSWR circle
-Gimn=(1-VSWRin)/(1+VSWRin)
-dvimn=(1-Gimn^2)*conj(Gin)/(1-abs(Gimn*Gin)^2); //circle center
-rvimn=(1-abs(Gin)^2)*abs(Gimn)/(1-abs(Gimn*Gin)^2); //circle radius
-
-//plot VSWRin=1.5 circle in the Smith Chart
-plot(real(dvimn)+rvimn*cos(a),imag(dvimn)+rvimn*sin(a),'g','linewidth',2);
-
-
-//plot a graph of the output VSWR as a function of the Gs position on the constant VSWRin circle
-Gs=dvimn+rvimn*exp(%i*a);
-Gout=s22+s12*s21*Gs./(1-s11*Gs);
-
-//find the reflection coefficients at the input and output matching networks
-Gimn=abs((Gin-conj(Gs))./(1-Gin*Gs));
-Gomn=abs((Gout-conj(GL))./(1-Gout*GL));
-
-//and find the corresponding VSWRs
-VSWRin=(1+Gimn)./(1-Gimn);
-VSWRout=(1+Gomn)./(1-Gomn);
-
-figure; //open new figure for the VSWR plot
-plot(a/%pi*180,VSWRout,'r',a/%pi*180,VSWRin,'b','linewidth',2);
-legend('VSWR_{out}','VSWR_{in}');
-title('Input and output VSWR as a function of \Gamma_S position');
-xlabel('Angle \alpha, deg.');
-ylabel('Input and output VSWRs');
-mtlb_axis([0 360 1.3 2.3])
-
-
-//choose a new source reflection coefficient
-Gs=dvimn+rvimn*exp(%i*85/180*%pi);
-
-//find the corresponding output reflection coefficient
-Gout=s22+s12*s21*Gs./(1-s11*Gs);
-
-//compute the transducer gain in this case
-GT=(1-abs(GL)^2)*abs(s21)^2.*(1-abs(Gs).^2)./abs(1-GL*Gout).^2./abs(1-Gs*s11).^2;
-GT_dB=10*log10(GT)
-
-//find the input and output matching network reflection coefficients
-Gimn=abs((Gin-conj(Gs))./(1-Gin*Gs));
-Gomn=abs((Gout-conj(GL))./(1-Gout*GL));
-
-//and find the corresponding VSWRs
-VSWRin=(1+Gimn)./(1-Gimn)
-VSWRout=(1+Gomn)./(1-Gomn)
-
-//also compute the obtained noise figure
-F=Fmin+4*Rn/Z0*abs(Gs-Gopt)^2/(1-abs(Gs)^2)/abs(1+Gopt)^2;
+global Z0;
+Z0=50;
+//define the S-parameters of the transistor
+s11=0.3*exp(%i*(+30)/180*%pi);
+s12=0.2*exp(%i*(-60)/180*%pi);
+s21=2.5*exp(%i*(-80)/180*%pi);
+s22=0.2*exp(%i*(-15)/180*%pi);
+s_param = [s11 s12;s21 s22]
+delta = abs(det(s_param));
+k = (1 - abs(s11)^2 - abs(s22)^2 +delta^2)./(2*abs(s12*s21));
+
+//noise parameters of the transistor
+Fmin_dB=1.5
+Fmin=10^(Fmin_dB/10);
+Rn=4;
+Gopt=0.5*exp(%i*45/180*%pi);
+
+
+//compute a noise circle
+Fk_dB=1.6;//desired noise performance
+Fk=10^(Fk_dB/10);
+
+Qk=abs(1+Gopt)^2*(Fk-Fmin)/(4*Rn/Z0); //noise circle parameter
+dfk=Gopt/(1+Qk); //circle center location
+rfk=sqrt((1-abs(Gopt)^2)*Qk+Qk^2)/(1+Qk); //circle radius
+
+
+//plot a noise circle
+a=[0:360]/180*%pi;
+mtlb_hold on
+plot(real(dfk)+rfk*cos(a),imag(dfk)+rfk*sin(a),'b','linewidth',2);
+
+//specify the goal gain
+G_goal_dB=8;
+G_goal=10^(G_goal_dB/10);
+
+
+//find constant operating power gain circles
+go=G_goal/abs(s21)^2; //normalized gain
+dgo=go*conj(s22-delta*conj(s11))/(1+go*(abs(s22)^2)); //center
+
+rgo=sqrt(1-2*K*go*abs(s12*s21)+go^2*abs(s12*s21)^2);
+rgo=rgo/abs(1+go*(abs(s22)^2)); //radius
+
+//map a constant gain circle into the Gs plane
+rgs=rgo*abs(s12*s21/(abs(1-s22*dgo)^2-rgo^2*abs(s22)^2));
+dgs=((1-s22*dgo)*conj(s11-delta*dgo)-rgo^2*s22)/(abs(1-s22*dgo)^2-rgo^2*abs(s22)^2);
+
+//plot constant gain circle in the Smith Chart
+mtlb_hold on
+plot(real(dgs)+rgs*cos(a),imag(dgs)+rgs*sin(a),'r','linewidth',2);
+
+
+//choose a source reflection coefficient Gs
+Gs=dgs+%i*rgs;
+
+//find the corresponding GL
+GL=(s11-conj(Gs))/(delta-s22*conj(Gs));
+
+//find the actual noise figure
+F=Fmin+4*Rn/Z0*abs(Gs-Gopt)^2/(1-abs(Gs)^2)/abs(1+Gopt)^2;
+
+//% print out the actual noise figure
+Actual_F_dB=10*log10(F)
+
+//find the input and output reflection coefficients
+Gin=s11+s12*s21*GL/(1-s22*GL);
+Gout=s22+s12*s21*Gs/(1-s11*Gs);
+
+
+//find the VSWRin and VSWRout
+Gimn=abs((Gin-conj(Gs))/(1-Gin*Gs));
+Gomn=abs((Gout-conj(GL))/(1-Gout*GL));
+
+VSWRin=(1+Gimn)/(1-Gimn); //VSWRin should be unity since we used the constant operating gain approach
+VSWRout=(1+Gomn)/(1-Gomn);
+
+//specify the desired VSWRin
+VSWRin=1.5;
+
+//find parameters for constant VSWR circle
+Gimn=(1-VSWRin)/(1+VSWRin)
+dvimn=(1-Gimn^2)*conj(Gin)/(1-abs(Gimn*Gin)^2); //circle center
+rvimn=(1-abs(Gin)^2)*abs(Gimn)/(1-abs(Gimn*Gin)^2); //circle radius
+
+//plot VSWRin=1.5 circle in the Smith Chart
+plot(real(dvimn)+rvimn*cos(a),imag(dvimn)+rvimn*sin(a),'g','linewidth',2);
+
+
+//plot a graph of the output VSWR as a function of the Gs position on the constant VSWRin circle
+Gs=dvimn+rvimn*exp(%i*a);
+Gout=s22+s12*s21*Gs./(1-s11*Gs);
+
+//find the reflection coefficients at the input and output matching networks
+Gimn=abs((Gin-conj(Gs))./(1-Gin*Gs));
+Gomn=abs((Gout-conj(GL))./(1-Gout*GL));
+
+//and find the corresponding VSWRs
+VSWRin=(1+Gimn)./(1-Gimn);
+VSWRout=(1+Gomn)./(1-Gomn);
+
+figure; //open new figure for the VSWR plot
+plot(a/%pi*180,VSWRout,'r',a/%pi*180,VSWRin,'b','linewidth',2);
+legend('VSWR_{out}','VSWR_{in}');
+title('Input and output VSWR as a function of \Gamma_S position');
+xlabel('Angle \alpha, deg.');
+ylabel('Input and output VSWRs');
+mtlb_axis([0 360 1.3 2.3])
+
+
+//choose a new source reflection coefficient
+Gs=dvimn+rvimn*exp(%i*85/180*%pi);
+
+//find the corresponding output reflection coefficient
+Gout=s22+s12*s21*Gs./(1-s11*Gs);
+
+//compute the transducer gain in this case
+GT=(1-abs(GL)^2)*abs(s21)^2.*(1-abs(Gs).^2)./abs(1-GL*Gout).^2./abs(1-Gs*s11).^2;
+GT_dB=10*log10(GT)
+
+//find the input and output matching network reflection coefficients
+Gimn=abs((Gin-conj(Gs))./(1-Gin*Gs));
+Gomn=abs((Gout-conj(GL))./(1-Gout*GL));
+
+//and find the corresponding VSWRs
+VSWRin=(1+Gimn)./(1-Gimn)
+VSWRout=(1+Gomn)./(1-Gomn)
+
+//also compute the obtained noise figure
+F=Fmin+4*Rn/Z0*abs(Gs-Gopt)^2/(1-abs(Gs)^2)/abs(1+Gopt)^2;
F_dB=10*log10(F) \ No newline at end of file