## Finite Temperature Variation - Heat Transfer

### Kaelyn (view profile)

on 3 Nov 2013

I am having trouble generating a coefficient matrix of different node types. Please take a look at my code and tell me where was my mistakes. My geometry cuts off at the top. Meaning it is half a node along the top.

```%Under slant RIGHT SIDE
for i= (.6*n^2)+1:(n*n)
```
```     if (mod(i,n)==1+s);
A(i,i-1)=1;
A(i,i+1)=1;
A(i,i)=((h*sqrt(2))/k)-2;
g(i)=((h*sqrt(2))/k)*Tinf;```
```    %BOTTOMROW!!!
%  Last line
elseif (mod(i,n)==0)
A(i,i-1)= 1;
A(i,i)=-3;
A(i,i-n)=1;
A(i,i+n)=1;
g(i)=0;
s=s+1;```
```              %last column
elseif (i==((n*n)-.4*n)+1)
A(i,i-1)= 1;
A(i,i)=-3;
A(i,i-n)=1;
A(i,i+n)=1;
g(i)=0;
%bottom right corner(n^2)
elseif (i==n*n)
A(i,i-1)= 1;
A(i,i)=-2;
A(i,i-n)=1;
g(i)=0;```
```     %Right side under slant %non-gen in between gen and slant
else
A(i,i+1)=1;
A(i,i-n)=1;
A(i,i+n)=1;
A(i,i-1)=1;
A(i,i)=-4;
g(i)=0;```
```       end
end ```
```T=A\g';
T( ~any(T,2), : ) = [];  %rows
```
```a = T == 10;
T(a) = NaN;
```
```T2= abs(real(T));
```
```Temp = vec2mat(T2,n);
```
```Temp1=diag(((.6*n^2)+1),0);
surf(Temp)
```

## Products

No products are associated with this question.