Why my fdtd program dont work properly?
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi, my fdtd program doesnt work properly. It is 4th order in space and 2nd order in time.
In 2th order in space my programworks correct.
L=100;
i=zeros(1,L);
v=zeros(1,L;
dz=0.01;
c=0.1;
l=250;
dt=dz*sqrt(l*c);
for n=1:2000
t=n*dt;
for k=1:L-1
if k==1
v(k)=v(k)-dt/(c*dz)*(i(k+1)-i(k));
elseif k==L-1
v(k)=v(k)-dt/(c*dz)*(i(k+1)-i(k));
else
v(k)=v(k)-(((6/7)*dt)/(c*24*dz))*(i(k-1)-(27*i(k))+(27*i(k+1))-i(k+2));
end
end
v(1)=sin(2*pi*t);
v(st)=0;
for k=2:L
if k==2
i(k)=i(k)-dt/(l*dz)*(v(k)-v(k-1));
elseif k==st
i(k)=i(k)-dt/(l*dz)*(v(k)-v(k-1));
else
i(k)=i(k)-(((6/7)*dt)/(l*24*dz))*(v(k-2)-(27*v(k-1))+(27*v(k))-v(k+1));
end
end
plot(v);
axis([1 L -3 3]);
frame = getframe;
end
Anyone knows whats wrong?
Anyone have a 4th order in space fdtd code? I searched and I didnt find anything.
Look at this url to see the results (in the red circle u can see the error): http://www.edaboard.com/attachments/95550d1377973325-.jpg
1 Kommentar
Walter Roberson
am 3 Sep. 2013
The edaboard site requires logging in to see the image. Please upload to a different site.
Antworten (0)
Siehe auch
Kategorien
Mehr zu Convert Image Type finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!