Prev: Alternative for matrix inverse?
Next: Library error
From: wahyoe Unggul on 25 Jun 2010 15:19 have a problem with the function (function iteration) below, the data (matrix) is small, the results obtained almost the same iterations but if the data matrix used in large differences in the final iteration on the results of a very large ========================================== function [DF,AR,AM]=analysis_result(element,dof,index,... IF,IR,S,SmS,JL,AML,RT,Support,type) clear Sff Srf; ndof=length([IF IR]); % find number degree of freedom % Perform Sff matrix Sff=S(IF,IF); % Perform Sff matrix Srf=S(IR,IF); % create joint load matrix (AJ) i=1:size(JL,1); AJ=zeros(1,ndof); AJ(dof(JL(i),2))=JL(i,2); AJ(dof(JL(i),3))=JL(i,3); AJ(dof(JL(i),4))=JL(i,4); AJ(dof(JL(i),5))=JL(i,5); AJ(dof(JL(i),6))=JL(i,6); AJ(dof(JL(i),7))=JL(i,7); end; % create joint load ekuivalen matrix AE [mi,ni]=size(index); % transpose to .. x m matrix (m=number of element) AMLT=AML'; AE=zeros(ndof,1); for i=1:size(element,1); Ji=index(i,:); AMLi=[ AMLT(1,i) ; AMLT(2,i) ; AMLT(3,i); AMLT(4,i) ; AMLT(5,i) ; AMLT(6,i); AMLT(7,i) ; AMLT(8,i) ; AMLT(9,i); AMLT(10,i); AMLT(11,i); AMLT(12,i)]; end; AE(Ji)=AE(Ji)-RT(:,:,i)'*AMLi; end; AE=AE'; % Calculate support reaction (AR) and joint displacement (DF) AC=AJ+AE; AFC=AC(IF)'; ARC=AC(IR)'; DF=Sff\AFC; AR=-ARC+Srf*DF; % Calculate member forces Dj=zeros(1,ndof); AM=zeros(ni,mi); Dj(IF)=DF; for i=1:size(element,1); DM=RT(:,:,i)*Dj(index(i,:))'; AM(:,i)=AML(i,:)'+SmS(:,:,i)*DM; end; AM=AM.'; % |