微波EDA网,见证研发工程师的成长!
首页 > 研发问答 > 微波和射频技术 > 电磁仿真讨论 > Fdtd matlab simulation problem

Fdtd matlab simulation problem

时间:03-30 整理:3721RD 点击:
Hi. Im trying to simulate a 4th order accurate in space equations but its not working. For 2nd order its working. Here is my code


len=100;
i=zeros(1,len+2);
v=zeros(1,len+2);

dz=0.01;
c=0.1;
l=250;
dt=dz*5;


for n=1:2000
t=n*dt;


for k=3:len+1
v(k)=v(k)-(dt/(c*24*dz))*(i(k-2)-(27*i(k-1))+(27*i(k))-i(k+1));
end


v(1)=sin(2*pi*t);
v(len)=0;


for k=2:len
i(k)=i(k)-(dt/(l*24*dz))*(v(k-1)-(27*v(k))+(27*v(k+1))-v(k+2));
end


plot(v);
axis([0 len -5 5]);

frame = getframe;

end

Anyone knows whats wrong or have a similar code to see it?

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top