View Single Post
  #6   Report Post  
Old May 12th 04, 06:14 AM
Joel Kolstad
 
Posts: n/a
Default

Arun S V wrote:
I am starting out on my class project which requires me to
write a 2D FDTD code.I am thinking of doing it in Matlab or C.Matlab
would offer good user friendliness but I have heard that Matlab being an
interpreted language is quite slow when it comes to loops.


We (myself and other classmates) did an entire numerical electromagnetics
class in Matlab. It's true that Matlab 'for' loops are slow... usually the
execution time of the programs was completely dominated by actually 'filling
up' the matrix (or cells) rather than, say, inverting the matrix, updating
cells, etc. Even so, for a 200x200 FDTD program on any contemporary PC
(1GHz), Matlab is plenty fast and I'd argue the ease of
plotting/manipulating the results more than outsweighs the generally
ignoranble speed penalty.

Heck, I did a FDTD program in C back in 1994 on some PA-RISC HPUX
workstation, and I'm _sure_ Matlab is a lot faster on a modern PC than C was
back then, and back then it was certainly fast enough!

BTW, look into parallelizing your code... sometimes it's a lot more trouble
than it's worth, but often it's very easy to get Matlab to fill in the
results of an entire row or an entire matrix in a single statement if you
code it correctly.

---Joel Kolstad