Hi,(adsbygoogle = window.adsbygoogle || []).push({});

I've been having some difficulty with Matlab. I keep getting confused with the indexing and the loops.

To set up the code, I am trying to implement the ADI method for a 2-D heat equation (u_t=u_xx+u_yy+f(x,y,t)). I have Dirichlet boundary conditions on the left, upper, and lower boundaries, and a mixed boundary condition on the right boundary.

The coefficient matrix and source vector look okay after the x-direction loop. I have spent well over a 10 hours trying to get it to work.

Can somebody check the code please?

Here's the code:

http://docs.google.com/Doc?docid=0AS848wqcdh80ZHE0Njk2a18xMjZnN3I2cG1kaw&hl=en

f, robinbc, and uexact are obtained from separate script files.

Thank you.

**Physics Forums | Science Articles, Homework Help, Discussion**

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Matlab - ADI Method Code

**Physics Forums | Science Articles, Homework Help, Discussion**