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.

Fdtd simulation problem

Status
Not open for further replies.

kotsoss

Newbie level 4
Newbie level 4
Joined
Apr 20, 2013
Messages
5
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Visit site
Activity points
1,315
Fdtd matlab simulation problem

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?
 
Last edited:

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top