function [] = QF_Solver() %Given QTAB nq, ns, and the system F=K*Q, transforms to similar system H=C*D %The essential boundary conditions are in the upper part of D via D=T*Q %Then C=T*K*T' and H=T*F. H=C*D is solved for D by partitions %Reverse transformation gives Q=T'*D and F=T'*H global QTAB F K Q nq ns %In truth table I, I(i) is 1 if Q(i) is an essential displacement in QTAB. I=zeros(ns,1); for i=1:nq I(QTAB(i,1))=1; end I %Copy the indices of the essential displacenemts from QTAB to V(1:nq) V=zeros(ns,1); V(1:nq,1) = QTAB(:,1); %Write the remaining indices in V(nq+1:ns) j=nq+1; for i=1:ns if I(i)==0 V(j)=i; j=j+1; end end V %Make transform T from the indices in V. T=zeros(ns) for i=1:ns T(i,V(i))=1; end T %find the similar system H=CD using the transform matrix T D=T*Q H=T*F C=T*K*T'; %Solve by partitions. The free displacements are DF=inv(CF)*(HF-CEF'*DE) DE=D(1:nq); CE=C(1:nq,1:nq); CF=C(nq+1:ns,nq+1:ns); CEF=C(1:nq,nq+1:ns); HF=H(nq+1:ns); DF=inv(CF)*(HF-CEF'*DE); %The Reactions are HE=CE*DE+CEF*DF. Insert parts DF in D and HE in H HE=CE*DE+CEF*DF; D(nq+1:ns)=DF H(1:nq)=HE %Transform the results back to the original Q=T'*D F=T'*H return; %==========