function [kc,kh] = rodtk(nodes,n1,n2,Kxx,A,hP) %function [kc,kh] = rodtk(nodes,n1,n2,Kxx,A,hP) % % Generate thermal conductivity element for 1-D rod element % % nodes = list of all nodes % n1, n2 = node numbers % Kxx = thermal conductivity % A = cross-section area % h = optional convection coefficient times perimeter % % k = conductivity matrix 2x2 % error(nargchk(5,6,nargin)); L = nodes(n2,1) - nodes(n1,1); kc = (A*Kxx/L) * [1 -1 %% eq. 13.4.20 (typo in book) -1 1]; if nargin > 5 kh = (hP/6)*[2 1 1 2]; else kh = []; end