Welcome to our site! EDAboard.com is an international Electronic 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.
----------------------
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)
%er1ielectric constant of first medium
%er2ielectric 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
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.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.