%spESTtrussN2.m
close all 
clear
#dbwhere(617)
##
#https://github.com/danbri/Flatland/blob/master/fakes/foaftest.m
disp(' ' )
warning("off")  
#disp(' warning("off") ' )
#disp(' ' )
# :( re 'ft_render: skipping missing glyph for character ` 'more off;
## 
disp('==================================================================')
disp(' spESTtrussN2.m     ')
disp(' Analysis of a plane truss using the EST method. ')
disp(' The EST method finds the forces of members. ')
disp(' The equations matrix are non-symmetric sparse matrix. ')
## http://digi.lib.ttu.ee/opik_eme/slaidid/raamEST1en.pdf
##disp('  ')
disp('---  ')
## GNU octave version >= 3.0.x
##=========================================================================
## This Program is written by Andres Lahe,  2004-02-02
##                    e-mail: andres.lahe@ttu.ee
## LAST MODIFIED: Andres Lahe,   2013-07-08
## Copyright (c)  2010 by Tallinn University of Technology 
##                Department of Mechanics
##                http://www.ttu.ee/
##
## This program is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License
## as published by the Free Software Foundation; either version 2
## of the License, or (at your option) any later version.

## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
## GNU General Public License for more details.

## You should have received a copy of the GNU General Public License
## along with this program; if not, write to the Free Software
## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
## http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
##=========================================================================
# 
 eps1=0.000001;
 epsgraf=0.01;
#============= 
#---------  Number of truss nodes ----------
Number_of_truss_nodes=16  # 16
                            SolmedeArv=Number_of_truss_nodes;
#---------  Number of elements ----------
Number_of_elements=29  # 29
                            ElementideArv=Number_of_elements;
#---------  Number of supports ----------
Number_of_support_reactions=3  # 3
                            Ntoerkts=Number_of_support_reactions;
disp('  ') 
#=============
 d=3.0;     # the panel length
 Npanel=8;  # the number of panels
 L=24.0;    # the span of the truss
 H=4.0;     # the height of the truss
#==============

#==============
jaotT=L/8;
#==============
disp(' ')
#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
## ---- load variants -----
load_variant=1;
#load_variant=2
#load_variant=3
        koormusvariant=load_variant;
#
##%%%%%%%%%%%%%%%%%%%%%%%%%%%%
switch (koormusvariant)
case{1}
disp(' The load variant 1 ')
#
#==============
mjNr1=5;  # influence line diagrams numbers 
mjNr2=2;
mjNr3=4;
mjNr4=7;
mjNr5=9;
#==============
#disp(' Node forces in global  coordinates ')
#VJoud = zeros(SolmedeArv,2);
#
#==========
# Node forces in global  coordinates
#==========
VJoud=[# Fx    Fz  
         0     0;    # node 1
         0     0;    # node 2
         0     5;    # node 3
         0     0;    # node 4
         0    10;    # node 5
         0     0;    # node 6
         0     4;    # node 7
         0     0;    # node 8
         0     8;    # node 9
         0     0;    # node 10
         0     0;    # node 11
         0     0;    # node 12
         0     4;    # node 13
         0     0;    # node 14
         0     8;    # node 15
         0     0];   # node 16
#==========

#==========
# The unit load act at the nodes
#==========
YJoudS=[# Fx    Fz
          0     1;    # node 1
          0     0;    # node 2
          0     1;    # node 3
          0     0;    # node 4
          0     1;    # node 5
          0     0;    # node 6
          0     1;    # node 7
          0     0;    # node 8
          0     1;    # node 9
          0     0;    # node 10
          0     1;    # node 11
          0     0;    # node 12
          0     1;    # node 13
          0     0;    # node 14
          0     1;    # node 15
          0    1];    # node 16
#==========

#%disp(' ')
##%%%%
case{2}
disp(' The load variant 2 ')
##
case{3}
disp(' The load variant 3 ')
#%%%%%
otherwise
disp(' No load variant cases ')
endswitch
#%%%%%%%%
#==========
#    Nodal coordinates
#==========
krdn=[#  x       z
        0.0     0.0;    # node 1
        3      -2.4;    # node 2
        3       0.0;    # node 3
        6      -3.6;    # node 4
        6       0.0;    # node 5
        9      -4.0;    # node 6
        9       0.0;    # node 7
       12      -4.0;    # node 8
       12       0.0;    # node 9
       15        -4;    # node 10
       15       0.0;    # node 11
       18      -3.6;    # node 12
       18       0.0;    # node 13
       21      -2.4;    # node 14
       21       0.0;    # node 15
       24       0.0];   # node 16
#==========

#==========
#  The restrtictions on the support displacements.
# Support   u   w   hold on - 1, open - 0
#==========
tsolm=[# x     z
         1     1;    # node 1
         0     0;    # node 2
         0     0;    # node 3
         0     0;    # node 4
         0     0;    # node 5
         0     0;    # node 6
         0     0;    # node 7
         0     0;    # node 8
         0     0;    # node 9
         0     0;    # node 10
         0     0;    # node 11
         0     0;    # node 12
         0     0;    # node 13
         0     0;    # node 14
         0     0;    # node 15
         0     1];   # node 16
#==========

#==========
#----- Element topology ------
#==========
selemjl=[# n1 - beginning of the element,
#              n2 - end of the element
           1   2;    # element 1
           2   3;    # element 2
           1   3;    # element 3
           2   4;    # element 4
           2   5;    # element 5
           3   5;    # element 6
           4   5;    # element 7
           4   6;    # element 8
           5   6;    # element 9
           5   7;    # element 10
           6   7;    # element 11
           6   8;    # element 12
           6   9;    # element 13
           7   9;    # element 14
           8   9;    # element 15
           8  10;    # element 16
           9  10;    # element 17
          10  13;    # element 18
           9  11;    # element 19
          10  12;    # element 20
          10  11;    # element 21
          11  13;    # element 22
          12  13;    # element 23
          12  14;    # element 24
          13  14;    # element 25
          13  15;    # element 26
          14  15;    # element 27
          14  16;    # element 28
          15  16];   # element 29
#==========
#%%%%%%%%%%%%
SARV=size(krdn);
NSARV=SARV(1,1);
#%%%%%%%%%%%%
selem=[selemjl(:,1) selemjl(:,2)];
EARV=size(selem);
NEARV=EARV(1,1);
#%%%%%%%%%%%%
JOEARV=size(VJoud);
JOARV=JOEARV(1,1);
#%%%
YJOEARV=size(YJoudS);
YJOARV=YJOEARV(1,1);
#%%%
TOEARV=size(tsolm);
TOARV=TOEARV(1,1);
#%%%
for i=1:NSARV
sJrN(i)=i;
end
#
sJrNT=sJrN';
##%%%
for i=1:NEARV+Ntoerkts
JrN(i)=i;
end
%
JrNT=JrN';
#%%%%

#%%%%%%%%%%%%
#disp('-----------------------------')
disp('===============================')
disp(' Nodal coordinates ')
disp('JrNr        X        Z  ')
disp('-----------------------------')
#disp([krdn])
for i=1:NSARV
disp(sprintf('  %2i    %7.4f  %7.4f',sJrNT(i),    krdn(i,1), krdn(i,2)))
endfor
disp('-----------------------------')
#%%%
%SolmedeArv
%NSARV
if ((SolmedeArv-NSARV) !=0 )
disp(' ')
disp(' ------- ')
disp(' ')
Number_of_truss_nodes
sprintf('Nodes must be, and is  %d,%d',SolmedeArv,NSARV)
disp(' ')
error(' Error inserting the coordinates.')
endif
##%%%
disp('=========================')
disp(' Topology of elements    ')
disp('     At the     At the   ')
disp(' Nr  beginning, end  ')
disp('-------------------------')
#disp([selem])
for i=1:NEARV
disp(sprintf('  %2i     %2i    %2i',JrNT(i),    selemjl(i,1), selemjl(i,2)))
endfor
disp('-------------------------')
#%%%
if ((ElementideArv-NEARV)  !=0 )
disp(' ')
disp(' ------- ')
disp(' ')
Number_of_elements
sprintf(' Number of elements must be, and is  %d,%d',ElementideArv,NEARV)
disp(' ')
error(' Error inserting the topology of elements.')
endif
#
#%%%
%Number_of_support_reactions

#%%%%%%%%%%%%

disp('=====================================')
disp('  Node forces in global  coordinates ')
disp(' Node     Fx          Fz ')
disp('-------------------------------------')
#disp([VJoud])
for i=1:NSARV
disp(sprintf('  %2i  %9.4f  %9.4f',JrNT(i),  VJoud(i,1), VJoud(i,2) ))
endfor
disp('-------------------------------------')
#
if ((JOARV-SolmedeArv)  !=0 )
Number_of_truss_nodes
sprintf('Nodes must be, and is  %d,%d',SolmedeArv,JOARV)
error(' Error inserting the forces.')
endif
#
#%%%

%disp('-----------------------------')
disp('================================')
disp(' The unit load act at the nodes ')
disp(' Node     Fx   Fz    ')
disp('--------------------------------')
#disp([YJoudS])
for i=1:NSARV
disp(sprintf('  %2i     %2i    %2i',sJrNT(i),    YJoudS(i,1), YJoudS(i,2)))
endfor
disp('--------------------------------')
#
if ((YJOEARV-SolmedeArv)  !=0 )
Number_of_truss_nodes
sprintf('Nodes must be, and is  %d,%d',SolmedeArv,YJOEARV)
error(' Error inserting the unit loads.')
endif
#

#%%%
#disp('-----------------------------')
disp('==================================================')
disp(' The restrtictions on the support displacements. ')
disp('  Node     u     w  ;  hold on-1, open-0')
disp('--------------------------------------------------')
#disp([tsolm])
for i=1:NSARV
disp(sprintf('  %2i      %2i    %2i',sJrNT(i),    tsolm(i,1), tsolm(i,2)))
endfor
disp('-----------------------------')
#%%
if ((TOARV-SolmedeArv)  !=0 )
Number_of_truss_nodes
sprintf('Nodes must be, and is  %d,%d',SolmedeArv,TOARV)
error(' Error inserting the restrtictions on the support displacements.')
endif
#
#%%%

# Vabadusastmete nummerdamine
#vabastmnr
#NSARV
Nloe=0;
for i=1:NSARV
 if (tsolm(i,1) <= eps1)
      Nloe=Nloe+1;
      vabastmnr(i,1)=Nloe;
 endif
 if (tsolm(i,2) <= eps1)
      Nloe=Nloe+1;
      vabastmnr(i,2)=Nloe;
 endif
   eimidagi=1;
endfor
#
for i=1:NSARV
 if (tsolm(i,1) >= eps1)
      Nloe=Nloe+1;
      vabastmnr(i,1)=Nloe;
 endif
 if (tsolm(i,2) >= eps1)
      Nloe=Nloe+1;
      vabastmnr(i,2)=Nloe;
 endif
   eimidagi=1;
endfor
#
#disp('-----------------------------')
disp('======================================')
disp(' The forces numbers (daf''s) at nodes ')
disp('Node  X-direction  Z-direction ')
disp('--------------------------------------')
#disp([vabastmnr])
for i=1:NSARV
disp(sprintf('  %2i       %2i       %2i',sJrNT(i),    vabastmnr(i,1), vabastmnr(i,2)))
endfor
disp('--------------------------------------')
#%%%%%
###
for i=1:NEARV
LkoordN=selem(i,2);
AkoordN=selem(i,1);
DeltaX(i)=krdn(LkoordN,1)-krdn(AkoordN,1);
DeltaZ(i)=krdn(LkoordN,2)-krdn(AkoordN,2);
VGRx(i,1)=krdn(AkoordN,1);
VGRx(i,2)=krdn(LkoordN,1);
VGRz(i,1)=krdn(AkoordN,2);
VGRz(i,2)=krdn(LkoordN,2);
endfor
#
#Varda pikkus
#lvarras
for i=1:NEARV
lvarras(i,1)=sqrt(DeltaX(i)^2+DeltaZ(i)^2);
endfor
#
for i=1:NEARV
cosAlpha(i,1)=DeltaX(i)/lvarras(i,1);
cosBeta(i,1)=DeltaZ(i)/lvarras(i,1);
endfor
#
#disp('-----------------------------')
disp('===================================')
disp(' The direction cosines of elements ')
disp('Element  cosAlpha  cosBeta ')
disp('-----------------------------------')
#disp([cosAlpha cosBeta])
for i=1:NEARV
disp(sprintf('  %2i     %7.4f   %7.4f',JrNT(i),    cosAlpha(i,:), cosBeta(i,:)))
endfor
disp('-----------------------------------')
#
#%%%%
#Võrrandisüsteemi vasak pool
VVask=zeros(NEARV,NEARV);
NvvYhik=NEARV+3;
YhikVVask=-eye(3);
VVask(NEARV+1:NvvYhik,NEARV+1:NvvYhik)=YhikVVask;
#%%%%%%%%%%%%%%%%%%%
NNK=NvvYhik;
disp('-------- The sparse matrix instantiation --------  ')
disp('  spA=sparse(NNK,NNK)  ')
spA=sparse(NNK,NNK) % nullistan võrrandisüsteemi kordajate maatriksi
#--------- Define a vector B ------------
disp('-------- The right-hand side of the equations (RHS). --------  ')
disp('  B=zeros(NNK,1);  ')
B=zeros(NNK,1);   % nullistan võrrandisüsteemi vabaliikmed
disp('   ')
#%%%%%%%%%%%%%%%%%%%
Nr1=0;
#
for i=1:NEARV
SsolmA=selem(i,1);
SsolmL=selem(i,2);
XAsolm=vabastmnr(SsolmA,1);
ZAsolm=vabastmnr(SsolmA,2);
XLsolm=vabastmnr(SsolmL,1);
ZLsolm=vabastmnr(SsolmL,2);
#%VVask(XAsolm,i)=-cosAlpha(i,1);
#%VVask(ZAsolm,i)=-cosBeta(i,1);
#%VVask(XLsolm,i)=cosAlpha(i,1);
#%VVask(ZLsolm,i)=cosBeta(i,1);
#%%%%%%%%%%%%%%%%%%%
#Nr1=Nr1+1;
    Kom=',' ;  
    Semi=';';
str1=num2str(XAsolm);
str2=num2str(ZAsolm);
str3=num2str(XLsolm);
str4=num2str(ZLsolm);
#
Arv1=num2str(-cosAlpha(i,1));
Arv2=num2str(-cosBeta(i,1));
Arv3=num2str(cosAlpha(i,1));
Arv4=num2str(cosBeta(i,1));
#
Nelem=i;
str5=num2str(Nelem) ;
 str=['spA=spSisestaArv(spA',Kom, str1,Kom, str5, Kom, Arv1,')',Semi];
 cmd = sprintf(str);
 eval(cmd); 
#
 str=['spA=spSisestaArv(spA',Kom, str2,Kom, str5, Kom, Arv2,')',Semi];
 cmd = sprintf(str);
 eval(cmd); 
#
 str=['spA=spSisestaArv(spA',Kom, str3,Kom, str5, Kom, Arv3,')',Semi];
 cmd = sprintf(str);
 eval(cmd);  
#
 str=['spA=spSisestaArv(spA',Kom, str4,Kom, str5, Kom, Arv4,')',Semi];
 cmd = sprintf(str);
 eval(cmd);  
#%%%%%%%%%%%%%%%%%%%
endfor
#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#%spA
vorrandeidB=size(spA);
rows_of_equations=vorrandeidB(1,1);
cols_of_equations=vorrandeidB(1,2);
non_zero_elements_in_the_equations=nnz(spA);

spRidu=vorrandeidB(1,1);
pohivorrandiXe=vorrandeidB(1,2);
disp('  ')
disp('--------The equations are inserted into spA  --------  ')
spA_rows=sprintf('rows_of_equations: %d', spRidu)
spA_col=sprintf('cols_of_equations: %d', pohivorrandiXe)
spA_nnz=sprintf('non_zero_elements_in_the_equations: %d', nnz(spA))
nnzB=spA_nnz;
disp('  ')
Nr1=spRidu+1;
#
#disp('  ')
#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#YhikVVask
str1=num2str(Nr1-3);
str9=num2str(Nr1-3);
SpToe3x3=sparse(YhikVVask);
str=['spA=spInsertBtoA(spA',Kom, str1,Kom, str9,Kom, 'SpToe3x3',')',Semi];
      cmd = sprintf(str) 
      eval(cmd)
#
#%%%%%%%%%%%%%%
#spA  
#%%%%%%%%%%%%%%%%
VParem=zeros(NEARV+3,1);
for i=1:NSARV
Xsuunas=vabastmnr(i,1);
Zsuunas=vabastmnr(i,2);
VParem(Xsuunas,1)=VJoud(i,1);
VParem(Zsuunas,1)=VJoud(i,2);
endfor
#
#%%%%%%%%%%%%%%%
B=VParem;
#%%%%%%%%%%%%%%%%%%%
#
spA_rank = sprank(spA)
#
spA
#
B;
BsuurusS=size(B);
Bsuurus=BsuurusS(1,1);

#
disp(' Nr    B ')
disp('  ')
for i=1:Bsuurus
#  %9.3e %9.3f
vorrandiNr=i;
disp(sprintf('%3i %7.3f',vorrandiNr,B(i,1)))
endfor
disp('  ')
#
disp('%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ')
disp(' Solving system of sparse equations. ')
disp(' X=spA\B; ')
%%%%%%%%%%%%%%%%%%%%
X=spA\B; % lahend  võrrandisõteemist spA*X=B
%%%%%%%%%%%%%%%%%%%%%
XX=X;
#XX=inv(VVask)*VParem;
#XX=VVask\VParem;
#
disp('=========================================')
disp(' The internal force in truss members     ')
disp(' The last 3 forces are support reactions ')
disp('  Nr.     N')
disp('-----------------------------------------')
#disp([XX])
for i=1:NEARV+3
disp(sprintf('  %2i  %9.4f',JrNT(i),  XX(i)))
endfor
disp('-----------------------------------------')
#
#%%%%%%%%%%%%%
#Mõjujoonte leidmiseks
#VVaskP=inv(VVask);
[xXx, rcond] = inv(spA);
#xXx
rcond
#%%%%%%%%%%%%%%%
#%VVaskP=full(xXx);
#%%%%%%%%%%%%%%%%
# Leian mõjujoone koordinaadid
jx=0;
jz=0;
Xsuunas=zeros(1,1);
Zsuunas=zeros(1,1);
for i=1:NSARV
if (YJoudS(i,1) >= eps1)
  jx=jx+1;
  Xsns=vabastmnr(i,1);
Xsuunas(jx,1)=Xsns;
endif
if (YJoudS(i,2) >= eps1)
  jz=jz+1;
   Zsns=vabastmnr(i,2);
Zsuunas(jz,1)=Zsns;
endif
  eimidagi=1;
endfor
#%%%%%%%%%%%%%%%%%%%%
#
MjNsi=size(VVask);
#MjNsi=size(VVaskP);
MjN=MjNsi(1,1);
MjARVz=size(Zsuunas);
NMjARVz=MjARVz(1,1);
#
MjARVx=size(Xsuunas);
NMjARVx=MjARVx(1,1);
#
#%%%%%%%%%
##xXx
spMjZ=sparse(NMjARVz,NMjARVz);
spMjX=sparse(NMjARVx,NMjARVx);
#spMjZ=sparse(3,3);
#spMjX=sparse(3,3);
#
if (NMjARVz > 1)
  for i=1:NMjARVz
     NzS=Zsuunas(i,1);
     for j=1:MjN
       spMjZ(j,i)=xXx(j,NzS);
     endfor
  endfor
endif
#
if (NMjARVx > 1)
  for i=1:NMjARVx
      NxS=Xsuunas(i,1);
      for j=1:MjN
        spMjX(j,i)=xXx(j,NxS);
      endfor
  endfor
endif
#
MjZ=full(spMjZ);
MjX=full(spMjX);
#%%%%%%%%%
#%# Mõjujoonte maatriks MjZ (kõigile varrastele ja tugedele)
#%if (NMjARVz > 1)
#%  for i=1:NMjARVz
#%     NzS=Zsuunas(i,1);
#%     for j=1:MjN
#%       MjZ(j,i)=VVaskP(j,NzS);
#%     endfor
#%  endfor
#%endif
#%%%%%%%%%%
#%% Mõjujoonte maatriks MjX (kõigile varrastele ja tugedele)
#%if (NMjARVx > 1)
#%  for i=1:NMjARVx
#%      NxS=Xsuunas(i,1);
#%      for j=1:MjN
#%        MjX(j,i)=VVaskP(j,NxS);
#%      endfor
#%  endfor
#%endif
#%%%%%%%%%%
# Koordinaadid mõjujoontele
NKo=0;
for i=1:NSARV
  for j=1:NMjARVz
         absvahe=abs(vabastmnr(i,2)-Zsuunas(j,1));
     if (absvahe <= eps1)
       NKo=NKo+1;
      Xmjk(NKo,1)=krdn(i,1);
     endif
      eimidagi=1;
   endfor
endfor
#

#
disp('================================================')
disp(' The influence line x-coordinates ')
disp('------------------------------------------------')
disp([Xmjk'])
disp('------------------------------------------------')
#
MX0=size(Xmjk);
NMX=MX0(1,1);
Y00=zeros(NMX,1);
#

# The ordinates of an influence line for the members
disp('=====================================================')
disp('    The ordinates of the influence line  ')
disp('  The last 3 rows is for support reactions ')
disp('-----------------------------------------------------')
#disp([MjZ])'
for i=1:NEARV+3
#disp(sprintf('%i  %4.4e',JrNT(i),  MjZ(i,:)))
disp(sprintf(' %2i %7.4f %7.4f %7.4f %7.4f %7.4f %7.4f %7.4f %7.4f %7.4f',JrNT(i),  MjZ(i,:)))
#disp(sprintf('  %i  %10.6g',JrNT(i),  MjZ(i,:)))
endfor
disp('-----------------------------------------------------')
#MjZ

#pause

#%%%%%%%%%%%%
figure(1)


ax = gca ();
axy=[ 0   0   1   0.55];
#joonepaksus=0.50000
#joonepaksus=0.75000
#joonepaksus=3
#set (ax, "outerposition", axy);
set (ax, "outerposition", [ 0   0   1   0.55])
#ax = gca ();
#set (ax, "linewidth", joonepaksus);
#
grid off
#
Lkorg=L;
#
for j=1:NEARV
       IR=j;
 # 
   axis([-d L+d -H-2.0 1.0 ], "ij")
 #
plot(VGRx(IR,:),VGRz(IR,:),"3")
hold on
endfor
#

#
title('The truss structure',"fontsize",12)
ax=gca();
      xlabel('x',"fontsize",12)
      ylabel('z',"fontsize",12)
 xticks(1,:)=0.0:jaotT:L;
 set (ax, "xtick", xticks)
#
#%Sõlmede numbrid
TTT=' ';
TST=' ';
TT1=' ';
TT1=' ';
#%%%%%%%%%
for i=1:NSARV;
#
   IR=i;
   TTT=eval(sprintf('%i',IR));
   TST=int2str(TTT);
 
text(krdn(IR,1), krdn(IR,2)+0.17, TST)
#
endfor
#
#%% Varraste numbrid
for j=1:NEARV;
#
   IR=j;
   TTT=eval(sprintf('%i',IR));
   TST=int2str(TTT);
text((VGRx(IR,1)+VGRx(IR,2))/2+0.1, (VGRz(IR,1)+VGRz(IR,2))/2, TST)
#
endfor
#text(L/2-d/2, -H-d/2, 'The truss structure')
#
hold off
#%%%%%
#axis([-d L+d 1.0 -H-2.0], "ij")
pause (1)
#
#Vaata: http://www.gnu.org/software/octave/doc/interpreter/Printing-Plots.html
#
#print('-deps','The_truss_structure.eps');
print('-dpng','The_truss_structure.png');
#print('-dfig','-landscape','-mono','-solid','The_truss_structure.fig');
refresh
#
pause (1) # octave
#
#%%%%%%%%%%%%%%
SR=MjZ(mjNr1,:);
#
maxN=max(SR(:));
maxN=maxN+0.1;
#
minN=min(SR(:));
minN=minN-0.1;
#%%%%%%%%%%%%
TTT=eval(sprintf('%i',mjNr1));
   TST=int2str(TTT);
Nmj=['N' TST];
#'
Tiitel1=['Member N' TST ' influence line'];
#dostring_escapes (string)
MojujnPNG=['MojujoonN' TST '.png'];
MojujnEPS=['MojujoonN' TST '.eps'];
MojujnFIG=['MojujoonN' TST '.fig'];
#%%%%%%%%%%%%
figure(2)
axis on
#
MjZZ(:,1)=MjZ(TTT,:);
plot(Xmjk(:,1),MjZZ(:,1),"3",Xmjk(:,1),Y00,"3")
grid("on")
#
ax = gca ();
set (ax, "outerposition", [ 0  0  1 0.55])
#
axis([-d L+d minN maxN], "ij")  # telgede piirid [Xalg Xlõpp Zalg Zlõpp]
#grid("on")
title(Tiitel1,"fontsize",12)
ax=gca();
        xlabel('x [m]',"fontsize",10)
	ylabel(Nmj,"fontsize",10)
ax = gca ();
 xticks(1,:)=0.0:jaotT:L;
 set (ax, "xtick", xticks)
#
#print('-deps',MojujnEPS);
print('-dpng',MojujnPNG);
#print('-dfig','-landscape','-mono','-solid',MojujnFIG);
refresh
#
pause (1) # octave
#%%%%%%%%%%%%%%%%%%
SR=MjZ(mjNr2,:);
#
maxN=max(SR(:));
maxN=maxN+0.1;
#
minN=min(SR(:));
minN=minN-0.1;
#
#%%%%%%%%%%%%
TTT=eval(sprintf('%i',mjNr2));
   TST=int2str(TTT);
#http://sunsite.univie.ac.at/textbooks/octave/octave_6.html
#implicit_num_to_str_ok
#isspace (s)
#
Tiitel1=['Member N' TST ' influence line'];
MojujnPNG=['MojujoonN' TST '.png'];
MojujnEPS=['MojujoonN' TST '.eps'];
MojujnFIG=['MojujoonN' TST '.fig'];
#%%%%%%%%%%%%
hold on #%%% kindlustas gridi püsimise
figure(3)
axis on
#
#eval(sprintf("gset output \"%s\";", filename));
#
MjZZ(:,1)=MjZ(TTT,:);
plot(Xmjk(:,1),MjZZ(:,1),"3",Xmjk(:,1),Y00,"3")
grid("on") 
#
ax = gca ();
axy=[ 0   0   1   0.55];
set (ax, "outerposition", [ 0  0  1 0.55])
#
axis([-d L+d minN maxN], "ij")  # telgede piirid [Xalg Xlõpp Zalg Zlõpp]
grid("on")
title(Tiitel1,"fontsize",12)
ax=gca();
        xlabel('x [m]',"fontsize",10)
	ylabel(Nmj,"fontsize",10)
ax = gca ();
 xticks(1,:)=0.0:jaotT:L;
 set (ax, "xtick", xticks)
#
#print('-deps',MojujnEPS);
print('-dpng',MojujnPNG);
#print('-dfig','-landscape','-mono','-solid',MojujnFIG);
refresh
#
pause (1) # octave
#%%%%%%%%%%%%%%%%%
SR=MjZ(mjNr3,:);
#
maxN=max(SR(:));
maxN=maxN+0.1;
#
minN=min(SR(:));
minN=minN-0.1;
#
#%%%%%%%%%%%%
TTT=eval(sprintf('%i',mjNr3));
   TST=int2str(TTT);
Nmj=['N' TST];
#
Tiitel1=['Member N' TST ' influence line'];
MojujnPNG=['MojujoonN' TST '.png'];
MojujnEPS=['MojujoonN' TST '.eps'];
MojujnFIG=['MojujoonN' TST '.fig'];
#%%%%%%%%%%%%
figure(4)
axis on
#
MjZZ(:,1)=MjZ(TTT,:);
plot(Xmjk(:,1),MjZZ(:,1),"3",Xmjk(:,1),Y00,"3")
grid("on")
#
ax = gca ();
axy=[ 0   0   1   0.55];
set (ax, "outerposition", [ 0  0 1 0.55])
#
axis([-d L+d minN maxN ], "ij")  # telgede piirid [Xalg Xlõpp Zalg Zlõpp]
grid("on")
title(Tiitel1,"fontsize",12)
ax=gca();
        xlabel('x [m]',"fontsize",10)
	ylabel(Nmj,"fontsize",10)
ax = gca ();
 xticks(1,:)=0.0:jaotT:L;
 set (ax, "xtick", xticks)
#
#print('-deps',MojujnEPS);
print('-dpng',MojujnPNG);
#print('-dfig','-landscape','-mono','-solid',MojujnFIG);
refresh
#
pause (1) # octave
#%%%%%%%%%%
SR=MjZ(mjNr4,:);
#
maxN=max(SR(:));
maxN=maxN+0.1;
#
minN=min(SR(:));
minN=minN-0.1;
#
#%%%%%%%%%%%%
TTT=eval(sprintf('%i',mjNr4));
   TST=int2str(TTT);
Nmj=['N' TST];
#
Tiitel1=['Member N' TST ' influence line'];
MojujnPNG=['MojujoonN' TST '.png'];
MojujnEPS=['MojujoonN' TST '.eps'];
MojujnFIG=['MojujoonN' TST '.fig'];
#%%%%%%%%%%%%
figure(5)
axis on
#
MjZZ(:,1)=MjZ(TTT,:);
plot(Xmjk(:,1),MjZZ(:,1),"3",Xmjk(:,1),Y00,"3")
grid("on")
#
ax = gca ();
set (ax, "outerposition", [ 0  0  1 0.55])
#
axis([-d L+d minN maxN], "ij")  # telgede piirid [Xalg Xlõpp Zalg Zlõpp]
grid("on")
title(Tiitel1,"fontsize",12)
ax=gca();
        xlabel('x [m]',"fontsize",10)
	ylabel(Nmj,"fontsize",10)
ax = gca ();
 xticks(1,:)=0.0:jaotT:L;
 set (ax, "xtick", xticks)
#
#print('-deps',MojujnEPS);
print('-dpng',MojujnPNG);
#print('-dfig','-landscape','-mono','-solid',MojujnFIG);
refresh
#
pause (1) # octave
%%%%%%%%%%%%%%%%%
SR=MjZ(mjNr5,:);
#
maxN=max(SR(:));
maxN=maxN+0.1;
#
minN=min(SR(:));
minN=minN-0.1;
#
#%%%%%%%%%%%%
TTT=eval(sprintf('%i',mjNr5));
   TST=int2str(TTT);
Nmj=['N' TST];
#
Tiitel1=['Member N' TST ' influence line'];
MojujnPNG=['MojujoonN' TST '.png'];
MojujnEPS=['MojujoonN' TST '.eps'];
MojujnFIG=['MojujoonN' TST '.fig'];
#%%%%%%%%%%%%
figure(6)
axis on
#
#http://osdir.com/ml/gnu.octave.general/2005-03/msg00278.html
#eval(sprintf("gset output \"%s\";", filename));
#
MjZZ(:,1)=MjZ(TTT,:);
plot(Xmjk(:,1),MjZZ(:,1),"3",Xmjk(:,1),Y00,"3")
grid("on")
#
ax = gca ();
set (ax, "outerposition", [ 0  0  1 0.55])
#
axis([-d L+d minN maxN], "ij")  # telgede piirid [Xalg Xlõpp Zalg Zlõpp]
grid("on")
title(Tiitel1,"fontsize",12)
ax=gca();
        xlabel('x [m]',"fontsize",10)
	ylabel(Nmj,"fontsize",10)
ax = gca ();
 xticks(1,:)=0.0:jaotT:L;
 set (ax, "xtick", xticks)
#
#print('-deps',MojujnEPS);
#print('-dpng',MojujnPNG);
print('-dfig','-landscape','-mono','-solid',MojujnFIG);
refresh
#
pause (1) # octave
##%%%%%%%%%%%%%%%%%%%%%%%%%%
#pause(1)
figure(7)
spy(spA)
grid
title('spy(spA) - the sparse matrix spA(32,32)  non zero elements [8.3%] ')
refresh
#
#print('-deps','spESTtala_h6remaatriks.eps');
#print('-dpng','spESTtala_h6remaatriks.png');
print('-dfig','-landscape','-mono','-solid','spTruss_h6remaatriks.fig');
#refresh
#
#pause (1) # octave
##%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%http://www.obihiro.ac.jp/~suzukim/masuda/octave/html3/octave_91.html#SEC187
%Table 15.1: Available special characters in TEX mode
#disp('-----------------------------------')
disp('  ')
disp(' The END ')
#%%%%%%%%%%%%%%%


