function spF=ysplfmhvII(baasi0,S,x,l,EA,GAr,EJ)
# fransfer matrix of the second order analysis for a 
# frame (Sign Convention 2)
# Zp=F*Zv, Zp'=[Up Wp Fip Sp Hp Mp]
# 
#  EA - axial stiffness of the element
#  GAr - shear stiffness of the element
#  EJ - bending stiffness of the element
#  l - length of member
#  baasi0 -- scaling multiplier for the displacements (i = EJ/l)
#  S - axial force
#
##=========================================================================
## This Program is written by Andres Lahe,   2009-02-14
##                    e-mail: andres.lahe@ttu.ee
## LAST MODIFIED: Andres Lahe,    2010-03-12
## Copyright (c)  2009 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
##=========================================================================
#
#
#l=x;
lp=l;
#
 mark1='-'; mark2='+';
 if S>=0
    mark=mark2;
 end
  if S<0
    mark=mark1;
 end
   eps1=0.000001;
   EIJ=EJ;
  nu=tnnusarv(lp,S,EIJ);
#  compression
 if strcmp(mark1,mark) == 1
   if nu <=eps1
      nu=nu+eps1; 
      S=0.0;
      spF=ysplfhlin(baasi0,x,EA,GAr,EIJ);

   else
      cs=cos((nu*x)/l);
      ss=sin((nu*x)/l);
#      F=eye(6);
#      F(1,4)=-(x/EA)*baasi0;
#      F(2,3)=-ss*l/nu;
#      F(2,5)=(l^3*(nu*x/l-ss)/(nu^3*EIJ))*baasi0;
#      F(2,6)=(l^2*(1-cs)/(nu^2*EIJ))*baasi0;
#      F(3,3)=cs;
#      F(3,5)=-(l^2*(1-cs)/(nu^2*EIJ))*baasi0;
#      F(3,6)=-(l*ss/(nu*EIJ))*baasi0;
#      F(4,4)=-1;
#      F(5,5)=-1;
#      F(6,3)=-nu*EIJ*ss/(l*baasi0);
#      F(6,5)=-l*ss/nu;
#      F(6,6)=-cs;
 Fsisse=[1 1  1;
        2  2  1;
        1  4  -(x/EA)*baasi0;
        2  3  -ss*l/nu;
        2  5  (l^3*(nu*x/l-ss)/(nu^3*EIJ))*baasi0;
        2  6  (l^2*(1-cs)/(nu^2*EIJ))*baasi0;
        3  3  cs;
        3  5  -(l^2*(1-cs)/(nu^2*EIJ))*baasi0;
        3  6  -(l*ss/(nu*EIJ))*baasi0;
        4  4  -1;
        5  5  -1;
        6  3  -nu*EIJ*ss/(l*baasi0);
        6  5  -l*ss/nu;
        6  6  -cs];
spF=spconvert(Fsisse);
#%%
   end
 end
#  tension
 if strcmp(mark2,mark) == 1
   if nu <=eps1
      nu=nu+eps1; 
      S=0.0;
      spF=ysplfhlin(baasi0,x,EA,GAr,EIJ);
   else
      cs=cosh((nu*x)/l);
      ss=sinh((nu*x)/l);
#      F=eye(6);
#      F(1,4)=-(x/EA)*baasi0;
#      F(2,3)=-ss*l/nu;
#      F(2,5)=-(l^3*(nu*x/l-ss)/(nu^3*EIJ))*baasi0;
#      F(2,6)=-(l^2*(1-cs)/(nu^2*EIJ))*baasi0;
#      F(3,3)=cs;
#      F(3,5)=(l^2*(1-cs)/(nu^2*EIJ))*baasi0;
#      F(3,6)=-(l*ss/(nu*EIJ))*baasi0;
#      F(4,4)=-1;
#      F(5,5)=-1;
#      F(6,3)=nu*EIJ*ss/(l*baasi0);
#      F(6,5)=-l*ss/nu;
#      F(6,6)=-cs;
 Fsisse=[1 1  1;
        2  2  1;
        1  4  -(x/EA)*baasi0;
        2  3  -ss*l/nu;
        2  5  -(l^3*(nu*x/l-ss)/(nu^3*EIJ))*baasi0;
        2  6  -(l^2*(1-cs)/(nu^2*EIJ))*baasi0;
        3  3  cs;
        3  5  (l^2*(1-cs)/(nu^2*EIJ))*baasi0;
        3  6  -(l*ss/(nu*EIJ))*baasi0;
        4  4  -1;
        5  5  -1;
        6  3  nu*EIJ*ss/(l*baasi0);
        6  5  -l*ss/nu;
        6  6  -cs];
spF=spconvert(Fsisse);
#
   end
 end
endfunction

