Got Questions? Get Answers.
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
2D finite difference code for non steady state Heat Equation

Subject: 2D finite difference code for non steady state Heat Equation

From: saheed

Date: 10 Oct, 2013 12:32:06

Message: 1 of 2

Hi guys, I am writing a matlab code for 2D non steady state heat equation for non uniform grids. i am having a problem with adding the time domain index (k) to my equation:
for j=1:1:m
    for i=2:1:n
        T(j,i)=T(j,i)+ lambda*( T(j,i+1) -4*T(j,i) + T(j,i-1)+T(j+1,i)+T(j-1,i) )
    end
end
Anyone with some hints should help me out. still I would appreciate if i can get a template code to solve the problem. Thanks

Subject: 2D finite difference code for non steady state Heat Equation

From: Nasser M. Abbasi

Date: 10 Oct, 2013 16:36:40

Message: 2 of 2

On 10/10/2013 7:32 AM, saheed wrote:
> Hi guys, I am writing a matlab code for 2D non steady state heat equation for non uniform grids.
>i am having a problem with adding the time domain index (k) to my equation:
> for j=1:1:m
> for i=2:1:n
> T(j,i)=T(j,i)+ lambda*( T(j,i+1) -4*T(j,i) + T(j,i-1)+T(j+1,i)+T(j-1,i) )
> end
> end
> Anyone with some hints should help me out. still I would appreciate if
>i can get a template code to solve the problem. Thanks
>

I do not see an 'h_x' and 'h_y' there? How come this is for
non uniform?

Any way. There is no time domain index.

The current matrix represents the current time.

When writing T(i,j)= T(i,j) + .....

you are basically updating in time the LHS from the older
time step in the RHS.

If needed, depending on the algorithm, another copy of the matrix T is used.
That is all. You do not need to keep a copy of T for each time step. THat is not
how things are implemented. Else, you'll run out of RAM soon, and it makes no
sense to keep a copy of T for each time step.

--Nasser



  

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us