Last active
November 2, 2016 15:15
-
-
Save ssavi/87aa6131a2528efa499925476f4635d4 to your computer and use it in GitHub Desktop.
( This Files ran Successfully on Online Octave Platform )
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%To illustrate the Rectangular Waveguide TM mode using MATLAB | |
clc; | |
close all; | |
clear all; | |
f=8e9; | |
w=2*pi*f; | |
t=1/f; | |
L=3e11/f; | |
B=2*pi/L; | |
g=i*B; | |
u=4*pi*1e-7; | |
E=8.858e-12; | |
H=(g*g)+(w*w*u*E); | |
a=10; | |
b=5; | |
m=input('input the value of m = '); | |
n=input('input the value of n = '); | |
X=0:0.1:10; | |
Y=0:0.05:5; | |
Z=0:0.2:20; | |
A=-g/H; | |
C=i*w*E/H; | |
Ex=abs(A.*((m*pi)/a).*cos(((m*pi)/a).*X).*sin(((n*pi)/b)*Y).*(exp((i*w*t)-(g*Z)))); | |
Ey=abs(A.*((n*pi)/b).*sin(((m*pi)/a).*X).*cos(((n*pi)/b)*Y).*(exp((i*w*t)-(g*Z)))); | |
Ez=abs(sin(((m*pi)/a).*X).*sin(((n*pi)/b)*Y).*(exp((i*w*t)-(g*Z)))); | |
Hx=abs(C.*((n*pi)/b).*sin(((m*pi)/a).*X).*cos(((n*pi)/b)*Y).*(exp((i*w*t)-(g*Z)))); | |
Hy=abs(-C.*((m*pi)/a).*cos(((m*pi)/a).*X).*sin(((n*pi)/b)*Y).*(exp((i*w*t)-(g*Z)))); | |
[HX]=meshgrid(Hx); | |
[HY]=meshgrid(Hy); | |
[EX]=meshgrid(Ex); | |
[EY]=meshgrid(Ey); | |
[EZ]=meshgrid(Ez); | |
HZ=zeros(101); | |
[Z]=meshgrid(Z); | |
set(gcf,'Color',[1,1,1]) | |
subplot(2,3,1); mesh(EX); title('EX Component in Y and Z direction','Color','b');xlabel('Ex'); ylabel('Y'), zlabel('Z'); | |
subplot(2,3,2); mesh(EY); title('EY Component in X and Z direction','Color','b');xlabel('X'); ylabel('Ey'), zlabel('Z'); | |
subplot(2,3,3); mesh(EZ); title('EZ Component in X and Y direction','Color','b');xlabel('X'); ylabel('Y'), zlabel('Ez'); | |
subplot(2,3,4); mesh(HX); title('HX Component in Y and Z direction','Color','b');xlabel('Hx'); ylabel('Y'), zlabel('Ez'); | |
subplot(2,3,5); mesh(HY); title('HY Component in X and Z direction','Color','b');xlabel('X'); ylabel('Hy'), zlabel('Z'); | |
subplot(2,3,6); mesh(HZ); title('HZ Component in X and Y direction','Color','b');xlabel('X'); ylabel('Y'), zlabel('Hz'); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%To Illustrate that the Rectangular Waveguide is used Widely | |
%------------------------------- | |
%TE wave is propagate | |
%------------------------------- | |
clc; | |
close all; | |
clear all; | |
a = 1; | |
b = a/2; | |
r = a/1.706; | |
area_rect = a * b; | |
area_cir = pi * r * r; | |
ratio = area_cir/area_rect | |
%---------------------------------- | |
%TM wave is propagate | |
%---------------------------------- | |
clc; | |
close all; | |
clear all; | |
a = 1; | |
b = a/2; | |
r = a/2.92; | |
area_rect = a *b; | |
area_cir = pi * r * r; | |
ratio = area_cir/area_rect |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%To Illustrate the Magic Tee with S-parameters using MATLAB | |
clc; | |
close all; | |
clear all; | |
[a] = input('Transmitted Signal '); | |
b(1)=(1/(2)^(1/2)).*(a(3)+a(4)); | |
b(2)=(1/(2)^(1/2)).*(a(3)-a(4)); | |
b(3)=(1/(2)^(1/2)).*(a(1)+a(2)); | |
b(4)=(1/(2)^(1/2)).*(a(1)-a(2)); | |
[S] = (1/(2)^(1/2)).*[0 0 1 1; 0 0 1 -1; 1 1 0 0; 1 -1 0 0]; | |
[B]=S*a; | |
if a(1)==0 && a(2)==0 && a(4)==0 && a(3)~=0 | |
sprintf('Reflected output[%f%f%f%f].',B) | |
display 'This is the property of H-plane Tee' | |
elseif a(1)==0 && a(2)==0 && a(3)==0 && a(4)~=0 | |
sprintf('Reflected output[%f%f%f%f].',B) | |
display 'This is the property of E-plane Tee' | |
elseif a(2)==0 && a(4)==0 && a(3)==0 && a(1)~=0 | |
sprintf('Reflected output[%f%f%f%f].',B) | |
display 'When power is fed to port 1 nothing comes out at port 2 even the area collinear ports(MAGIC!!!)'; | |
display 'Hence port 1 and 2 are ISOLATED PORTS'; | |
elseif a(1)==0 && a(2)~=0 && a(4)==0 && a(3)==0 | |
sprintf('Reflected output[%f%f%f%f].',B) | |
display 'When power is fed to port 2 nothing comes out at port 1 even the area collinear ports(MAGIC!!!)'; | |
display 'Hence port 1 and 2 are ISOLATED PORTS'; | |
elseif a(1)==0 && a(2)==0 && a(4)~=0 && a(3)~=0 | |
display 'Reflected Outputs'; (B) | |
display 'This is the property of ADDITIVE' | |
elseif a(1)~=0 && a(2)~=0 && a(4)==0 && a(3)==0 | |
display 'Reflected Outputs';(B) | |
display 'This is the property of SUBTRACTIVE' | |
elseif (a(1)==0 && a(2)==0 && a(4)==0 && a(3)==0) | |
display 'Reflected Outputs';(B) | |
display 'No Output' | |
end | |
if a(1)==1 && a(2)==1 && a(4)==1 && a(3)==1 | |
errordlg('Input to Magic Tee is not Valid','File Error'); | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment