Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

matlab coding for adi fdtd

Status
Not open for further replies.

ramani

Member level 4
Joined
Dec 21, 2005
Messages
78
Helped
2
Reputation
4
Reaction score
1
Trophy points
1,288
Location
india
Activity points
1,919
can anyone plz upload matlab coding for adi fdtd-(2d&3d)
 

these may be helpful, this is 2d

----------------------
function FDTD2_2= fdtd2_2(er1,er2, Mr1,Mr2, o1,o2, Et1,Et2,Et3,Et4,Et5,Ht1,Ht2)
%FDTD2_2 Implements FDTD algorithm for a domain of for Hy(k)=0 at the
%right boundary-Part2-Question2
%Draws the graphs of Ex at times of Et1,Et2,Et3,Et4,Et5 and Hy at times of
%Ht1,Ht2 where time is an integer
%If you do not want a graph at a specific time,just assign zero for that
%time(Et5 has to be assigned and it should be the largest time)
%er1:Dielectric constant of first medium
%er2:Dielectric constant of second medium
%Mr1:Relative permittivity of first medium
%Mr2:Relative permittivity of second medium
%o1:Conductivity of first medium
%o2:Conductivity of second medium

%Initializations
e1=er1*10^-9/36/pi;
e2=er2*10^-9/36/pi;
M1=Mr1*4*pi*10^-7;
M2=Mr2*4*pi*10^-7;
v1=1/(sqrt(M1*e1));
v2=1/(sqrt(M2*e2));
K=500;
K_D=250;
z=(0:K);
Ex=zeros(1,K+1);
Hy=zeros(1,K+1);
dz=0.015;
dt=2.5*10^-11;
T=1*10^-9;
N=2500;
h1=figure;
h2=figure;

%Computations
for i=1:Et5,

Ex1=Ex(1);
Ex2=Ex(2);
ExK=Ex(K);
ExK_plus1=Ex(K+1);
for j=1:K,
if j<=K_D
Hy(j)=Hy(j)-(dt/M1/dz)*(Ex(j+1)-Ex(j));
elseif j==K
Hy(j)=0;
else
Hy(j)=Hy(j)-(dt/M2/dz)*(Ex(j+1)-Ex(j));
end

end
for j=1:K+1,

if ((i-1)*dt)<=(6*T)
Ex(1)=exp(-(((i-1)*dt-3*T)^2)/(T^2));
else
Ex(1)=0;

end
if j~=1&j<=K_D
Ex(j)=(1-dt*o1/2/e1)/(1+dt*o1/2/e1)*Ex(j)-(dt/dz/e1)/(1+dt*o1/2/e1)*(Hy(j)-Hy(j-1));
elseif j==K_D+1
Ex(j)=(1-dt*o1/2/((e1+e2)/2))/(1+dt*o1/2/((e1+e2)/2))*Ex(j)-(dt/dz/((e1+e2)/2))/(1+dt*o1/2/((e1+e2)/2))*(Hy(j)-Hy(j-1));
elseif j>K_D+1&j<=K
Ex(j)=(1-dt*o2/2/e2)/(1+dt*o2/2/e2)*Ex(j)-(dt/dz/e2)/(1+dt*o2/2/e2)*(Hy(j)-Hy(j-1));
end
end

%Draws the graphs
if i==Et1|i==Et2|i==Et3|i==Et4
figure(h1);
end
if i==Et1
plot(z,Ex,'k');
hold on;
end
if i==Et2
plot(z,Ex,'b');
hold on;
end
if i==Et3
plot(z,Ex,'g');
hold on;
end
if i==Et4
plot(z,Ex,'r');
hold on;
end
if i==Ht1|i==Ht2
figure(h2);
end
if i==Ht1
plot(z,Hy,'c');
hold on;
end
if i==Ht2
plot(z,Hy,'m');
xlabel('z(0.015m)');
ylabel('Hy(A/m)');
title('FDTD2_2 Implements FDTD algorithm for a domain of for Hy(k)=0 at the right boundary-Part2-Question2');
legend('Hy at t1','Hy at t2');
grid;
hold on;
end
end
figure(h1);
plot(z,Ex,'y');
xlabel('z(0.015m)');
ylabel('Ex(V/m)');
title('FDTD2_2 Implements FDTD algorithm for a domain of for Hy(k)=0 at the right boundary-Part2-Question2');
legend('Ex at t1','Ex at t2','Ex at t3','Ex at t4','Ex at t5');
grid;
return
 

this is matlab coding for fdtd in 1d. it is not adi fdtd .
can any one please upload matlab coding for adi fdtd. i am finding difficult in implementation. it takes longer time for the simulation. i also find so much difficult in implementing pml condition.
atleast can anyone please guide me.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top