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

i am trying to solve and program a non linear differential equation in matlab where thermal conductivity depends on temparature.I am trying it to solve by explicit finite difference method.

the given equation is ∂^{2}t/∂x^{2}+∂^{2}t/∂y^{2}*k(t)= -q (x,y)

i have solved the equation taking k(t)= a-b*t,and when i further solved the equation it gave an quadratic equation. where temparature is the root of the equation.but unfortunately my program is running slow and not giving me precize results can anybody help me out in this.

n = 5;

x = linspace(0,1,n);

dx = x(2)-x(1);

y = x;

dy = dx;

Q =80;

M= zeros(n,n);

if (mod(n,2)==0)

M(n/2,n/2)=Q;

else

p = (n+1)/2 ;

M(p,p)= Q;

end

t = ones(n);

t(1,1:n) = 0;

t(n,1:n) = 0;

t(1:n,1) = 0;

t(1:n,n) = 0;

a = 1;

b = 0;

tic

error = 1; z = 0;

while error > 0.0000001

z = z+1;

tnew = t;

for i = 2:n-1

for j = 2:n-1

d = -((b*(tnew(i+1,j)+tnew(i-1,j)+ tnew(i,j+1)+tnew(i,j-1))) + (4*a));

e = ( a*(tnew(i+1,j)+tnew(i-1,j)+ tnew(i,j+1)+tnew(i,j-1))) + (M(i,j)* dx^2);

f = b*4;

answer=roots([f,d,e]);

t(i,j)= max(max(abs(answer)));

end

end

error = max(max(abs(tnew-t)));

end

toc

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

Join Physics Forums Today!

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

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

# Nonlinear conduction,where thermal conductivity depends on temparature

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