matlab.mathematica getting a warning while running the program
TRANSCRIPT
-
8/19/2019 Matlab.Mathematica Getting a Warning While Running the Program
1/28
Getting a warning while running theprogram.Matrix is close to singular or badlyscaled. Results may be inaccurate. RCOND =
1.!"!##e$%1&.. 's(ed by De)ipra(ash *padhyaya on #1 Mar #%1
+ am running the below gi)en program which gi)es the warning message.,ow to remo)e the warning.
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
A barrel vault has radius r=25 ft, subtended angle of 80 degrees,
length 50 f, and thickness 3in.Elastic modulus is 3 msi,Poissons ratio is0,and !eight of the shell is "0 lb #er s$uare ft. %!o curved edges are
su##orted b& rigid dia#hragm and the other t!o edges are free.
'olve using ( b& ( elements of a $uarter of the shell.
)ariable descri#tions
* k = element matri+ in the local a+es
* ke = element matri+ in the global a+es
* kb = element matri+ for bending stiffness
* ks = element matri+ for shear stiffness
* km = element matri+ for membrane stiffness
* f = element vector
* kk = s&stem matri+
* ff = s&stem vector
* dis# = s&stem nodal dis#lacement vector
* gcoord = coordinate values of each node
* nodes = nodal connectivit& of each element
* inde+ = a vector containing s&stem dofs associated !ith each element
http://in.mathworks.com/matlabcentral/profile/authors/3525591-deviprakash-upadhyayahttp://in.mathworks.com/matlabcentral/profile/authors/3525591-deviprakash-upadhyayahttp://in.mathworks.com/matlabcentral/profile/authors/3525591-deviprakash-upadhyaya
-
8/19/2019 Matlab.Mathematica Getting a Warning While Running the Program
2/28
* #ointb = matri+ containing sam#ling #oints for bending term
* !eightb = matri+ containing !eighting coefficients for bending term
* #oints = matri+ containing sam#ling #oints for shear term
* !eights = matri+ containing !eighting coefficients for shear term
* bcdof = a vector containing dofs associated !ith boundar& conditions
* bcval = a vector containing boundar& condition values associated !ith
* the dofs in bcdof
* kinmtsb = matri+ for kinematic e$uation for bending
* matmtsb = matri+ for material #ro#ert& for bending
* kinmtss = matri+ for kinematic e$uation for shear
* matmtss = matri+ for material #ro#ert& for shear
* kinmtsm = matri+ for kinematic e$uation for membrane
* matmtsm = matri+ for material #ro#ert& for membrane
* tr3d = transformation matri+ from local to global a+es
-$$$$$$$$$$$$$$$$$$$$$$$$$$ - input data or control parameters -$$$$$$$$$$$$$$$$$$$$$$$$$$$
clear
nel=- * number of elements
nnel=( * number of nodes #er element
ndof=- * number of dofs #er node
nnode=25 * total number of nodes in s&stem
sdof=nnode/ndof * total s&stem dofs
edof=nnel/ndof * degrees of freedom #er element
emodule=3e- * elastic modulus
-
8/19/2019 Matlab.Mathematica Getting a Warning While Running the Program
3/28
#oisson=0.0 * Poissons ratio
t=3 * #late thickness
ngl+b=2 ngl&b=2 * 2+2 auss1egendre $uadrature for bending
nglb=ngl+b/ngl&b * number of sam#ling #oints #er element for bending
ngl+s= ngl&s= * + auss1egendre $uadrature for shear
ngls=ngl+s/ngl&s * number of sam#ling #oints #er element for shear
-$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ - input data or nodal coordinate )alues -$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
gcoord=0.0 0.0 0.0 0.0 -.25 0.0 0.0 2.5 0.0 0.0 8.45 0.00.0 25.0 0.0
(.3( 0.0 10.38(.3( -.25 10.38(.3( 2.5 10.38(.3( 8.45 10.38(.3( 25.010.38
8.55 0.0 1.58.55 -.25 1.58.55 2.5 1.58.55 8.45 1.58.55 25.01.5
2.5 0.0 13.352.5 -.25 13.352.5 2.5 13.352.5 8.45 13.352.5 25.013.35
-. 0.0 15.85-. -.25 15.85-. 2.5 15.85-. 8.45 15.85-. 25.015.85
gcoord=2.0/gcoord
-$$$$$$$$$$$$$$$$$$$$$$$ - input data or nodal connecti)ity or each element -$$$$$$$$$$$$$$$$$$$$$$$
nodes=- 4 2 4 8 3 2 8 " ( 3 " 0 5 (
2 4 - 2 3 8 4 3 ( " 8 ( 5 0 "
- 4 2 4 8 3 2 8 " ( 3 " 20 5 (
2 22 4 - 22 23 8 4 23 2( " 8 2( 25 20 "
-$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ - input data or boundary conditions -$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
bcdof= 3 5 - 4 2 3 4 8 " 23 2( 25 2- 28 2" 30 ...
-
8/19/2019 Matlab.Mathematica Getting a Warning While Running the Program
4/28
3 33 5- 58 -0 - -3 8- 88 "0 " "3 - 8 20 ...
2 22 23 (- (8 50 * constrained dofs
bcval=6eros7si6e7bcdof * !hose described values are 0
-$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ - initiali/ation o matrices and )ectors -$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
ff=6eros7sdof, * s&stem force vector
kk=6eros7sdof,sdof * s&stem matri+
dis#=6eros7sdof, * s&stem dis#lacement vector
inde+=6eros7edof, * inde+ vector
kinmtsb=6eros73,edof * kinematic matri+ for bending
matmtsb=6eros73,3 * constitutive matri+ for bending
kinmtsm=6eros73,edof * kinematic matri+ for membrane
matmtsm=6eros73,3 * constitutive matri+ for membrane
kinmtss=6eros72,edof * kinematic matri+ for shear
matmtss=6eros72,2 * constitutive matri+ for shear
tr3d=6eros7edof,edof * transformation matri+
-$$$$$$$$$$$$$$$$$$$$$$$$$$$$ - orce )ector -$$$$$$$$$$$$$$$$$$$$$$$$$$$$
ff73=1-3.- * transverse force at node
ff7"=1224.2 * transverse force at node 2
ff75=1224.2 * transverse force at node 3
ff72=1224.2 * transverse force at node (
ff724=1-3.- * transverse force at node 5
ff733=1224.2 * transverse force at node -
-
8/19/2019 Matlab.Mathematica Getting a Warning While Running the Program
5/28
ff73"=12(5(.( * transverse force at node 4
ff7(5=12(5(.( * transverse force at node 8
ff75=12(5(.( * transverse force at node "
ff754=1224.2 * transverse force at node 0
ff7-3=1224.2 * transverse force at node
ff7-"=12(5(.( * transverse force at node 2
ff745=12(5(.( * transverse force at node 3
ff78=12(5(.( * transverse force at node (
ff784=1224.2 * transverse force at node 5
ff7"3=1224.2 * transverse force at node -
ff7""=12(5(.( * transverse force at node 4
ff705=12(5(.( * transverse force at node 8
ff7=12(5(.( * transverse force at node "
ff74=1224.2 * transverse force at node 20
723=1-3.- * transverse force at node 2
ff72"=1224.2 * transverse force at node 22
ff735=1224.2 * transverse force at node 23
ff7(=1224.2 * transverse force at node 2(
ff7(4=1-3.- * transverse force at node 25
-$$$$$$$$$$$$$$$$$$$$ - computation o element matrices and )ectors and their assembly -$$$$$$$$$$$$$$$$$$$$$
* for bending and membrane stiffness
#ointb,!eightb=fegl$d27ngl+b,ngl&b * sam#ling #oints 9 !eights
-
8/19/2019 Matlab.Mathematica Getting a Warning While Running the Program
6/28
matmtsm=fematiso7,emodule,#oisson/t * membrane material #ro#ert&
matmtsb=fematiso7,emodule,#oisson/t:3;2 * bending material #ro#ert&
**
* for shear stiffness
*
#oints,!eights=fegl$d27ngl+s,ngl&s * sam#ling #oints 9 !eights
shearm=0.5/emodule;7.0
-
8/19/2019 Matlab.Mathematica Getting a Warning While Running the Program
7/28
km=6eros7edof,edof * element membrane matri+
kb=6eros7edof,edof * element bending matri+
ks=6eros7edof,edof * element shear matri+
*111111111111111111111111111111111111111111111111111111
* numerical integration for bending term
*111111111111111111111111111111111111111111111111111111
for int+=ngl+b
+=#ointb7int+, * sam#ling #oint in +1a+is
!t+=!eightb7int+, * !eight in +1a+is
for int&=ngl&b
&=#ointb7int&,2 * sam#ling #oint in &1a+is
!t&=!eightb7int&,2 * !eight in &1a+is
sha#e,dhdr,dhds=feiso$(7+,& * com#ute sha#e functions and
* derivatives at sam#ling #oint
>acob2=fe>acob27nnel,dhdr,dhds,+#rime,rime * com#ute ?acobian
det>acob=det7>acob2 * determinant of ?acobian
inv>acob=inv7>acob2 * inverse of ?acobian matri+
dhd+,dhd&=federiv27nnel,dhdr,dhds,inv>acob * derivatives !.r.t.
* #h&sical coordinate
kinmtsb=fekinesb7nnel,dhd+,dhd& * bending kinematic matri+
kinmtsm=fekinesm7nnel,dhd+,dhd& * membrane kinematic matri+
*11111111111111111111111111111111111111111111
* com#ute bending element matri+
-
8/19/2019 Matlab.Mathematica Getting a Warning While Running the Program
8/28
*11111111111111111111111111111111111111111111
kb=kbacob
km=kmacob
end
end * end of numerical integration loo# for bending term
*111111111111111111111111111111111111111111111111111111
* numerical integration for bending term
*111111111111111111111111111111111111111111111111111111
for int+=ngl+s
+=#oints7int+, * sam#ling #oint in +1a+is
!t+=!eights7int+, * !eight in +1a+is
for int&=ngl&s
&=#oints7int&,2 * sam#ling #oint in &1a+is
!t&=!eights7int&,2 * !eight in &1a+is
sha#e,dhdr,dhds=feiso$(7+,& * com#ute sha#e functions and
* derivatives at sam#ling #oint
>acob2=fe>acob27nnel,dhdr,dhds,+#rime,rime * com#ute ?acobian
det>acob=det7>acob2 * determinant of ?acobian
inv>acob=inv7>acob2 * inverse of ?acobian matri+
dhd+,dhd&=federiv27nnel,dhdr,dhds,inv>acob * derivatives !.r.t.
* #h&sical coordinate
kinmtss=fekiness7nnel,dhd+,dhd&,sha#e * shear kinematic matri+
*1111111111111111111111111111111111111111
-
8/19/2019 Matlab.Mathematica Getting a Warning While Running the Program
9/28
* com#ute shear element matri+
*1111111111111111111111111111111111111111
ks=ksacob
end
end * end of numerical integration loo# for shear term
*11111111111111111111111111111111
* com#ute element matri+
*11111111111111111111111111111111
k=km
-
8/19/2019 Matlab.Mathematica Getting a Warning While Running the Program
10/28
sum=sum
end
if 7sum @ e15
kk7i,i=
end
end
end
*11111111111111111111111111111
* a##l& boundar& conditions
*11111111111111111111111111111
kk,ff=fea#l&c27kk,ff,bcdof,bcval
*1111111111111111111111111111
* solve the matri+ e$uation
*1111111111111111111111111111
dis#=kkff
num=sdof
dis#lace=num dis# * #rint nodal dis#lacements
*11111111111111111111111111111111111111111111111111111111111111
* 'ubBroutines
*****************
function #oint2,!eight2=fegl$d27ngl+,ngl&
*1111111111111111111111111111111111111111111111111111111111111111111
* Pur#ose
-
8/19/2019 Matlab.Mathematica Getting a Warning While Running the Program
11/28
* determine the integration #oints and !eighting coefficients
* of auss1egendre $uadrature for t!o1dimensional integration
*
* '&no#sis
* #oint2,!eight2=fegl$d27ngl+,ngl&
*
* )ariable Cescri#tion
* ngl+ 1 number of integration #oints in the +1a+is
* ngl& 1 number of integration #oints in the &1a+is
* #oint2 1 vector containing integration #oints
* !eight2 1 vector containing !eighting coefficients
*1111111111111111111111111111111111111111111111111111111111111111111
* determine the largest one bet!een ngl+ and ngl&
if ngl+ D ngl&
ngl=ngl+
else
ngl=ngl&
end
* initiali6ation
#oint2=6eros7ngl,2
!eight2=6eros7ngl,2
* find corres#onding integration #oints and !eights
#oint+,!eight+=fegl$d7ngl+ * $uadrature rule for +1a+is
-
8/19/2019 Matlab.Mathematica Getting a Warning While Running the Program
12/28
#oint&,!eight&=fegl$d7ngl& * $uadrature rule for &1a+is
* $uadrature for t!o1dimension
for int+=ngl+ * $uadrature in +1a+is
#oint27int+,=#oint+7int+
!eight27int+,=!eight+7int+
end
for int&=ngl& * $uadrature in &1a+is
#oint27int&,2=#oint&7int&
!eight27int&,2=!eight&7int&
end
BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
function matmtr+=fematiso7io#t,elastic,#oisson
*111111111111111111111111111111111111111111111111111111111111111111111111
* Pur#ose
* determine the constitutive e$uation for isotro#ic material
*
* '&no#sis
* matmtr+=fematiso7io#t,elastic,#oisson
*
* )ariable Cescri#tion
* elastic 1 elastic modulus
* #oisson 1 Poissons ratio
* io#t= 1 #lane stress anal&sis
-
8/19/2019 Matlab.Mathematica Getting a Warning While Running the Program
13/28
* io#t=2 1 #lane strain anal&sis
* io#t=3 1 a+is&mmetric anal&sis
* io#t=( 1 three dimensional anal&sis
*111111111111111111111111111111111111111111111111111111111111111111111111
if io#t== * #lane stress
matmtr+= elastic;71#oisson/#oisson/ ...
#oisson 0 ...
#oisson 0 ...
0 0 71#oisson;2
elseif io#t==2 * #lane strain
matmtr+= elastic;77
-
8/19/2019 Matlab.Mathematica Getting a Warning While Running the Program
14/28
#oisson 71#oisson #oisson 0 0 0
#oisson #oisson 71#oisson 0 0 0
0 0 0 712/#oisson;2 0 0
0 0 0 0 712/#oisson;2 0
0 0 0 0 0 712/#oisson;2
end
BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
function tr3d,+#rime,rime=fetransh7+coord,&coord,6coord,n
*11111111111111111111111111111111111111111111111111111111111111
* Pur#ose
* om#ute direction cosines bet!een three1dimensional
* local and global coordinate a+es
*
* '&no#sis
* tr3d,+#rime,rime=fetransh7+coord,&coord,6coord,n
*
* )ariable Cescri#tion
* +coord 1 nodal + coordinates 7(+
* &coord 1 nodal & coordinates 7(F
* 6coord 1 nodal 6 coordinates 7(F
* n 1 number of nodes #er element
* tr3d 1 3d transformation matri+ from local to global a+es
* +#rime 1 coordinate in terms of the local a+es 7(+
-
8/19/2019 Matlab.Mathematica Getting a Warning While Running the Program
15/28
* rime 1 coordinate in terms of the global a+es 7(F
*
* Gote
* %he local +1a+is is defined in the direction from the first node
* to the second node. Godes , 2 and ( define the local +&1#lane.
* %he local 61a+is is defined normal to the local +&1#lane.
* %he local &1a+is is defined normal to the + and 6 a+es.
*11111111111111111111111111111111111111111111111111111111111111111111111111
*
* com#ute direction cosines
*
v2+=+coord721+coord7
v2&=&coord721&coord7
v26=6coord7216coord7
l2=s$rt7v2+:2
-
8/19/2019 Matlab.Mathematica Getting a Warning While Running the Program
16/28
v(+=+coord7(1+coord7
v(&=&coord7(1&coord7
v(6=6coord7(16coord7
l(=s$rt7v(+:2
-
8/19/2019 Matlab.Mathematica Getting a Warning While Running the Program
17/28
*
* transformation matri+
*
for i=2/n
i=7i1/3
-
8/19/2019 Matlab.Mathematica Getting a Warning While Running the Program
18/28
-
8/19/2019 Matlab.Mathematica Getting a Warning While Running the Program
19/28
* st node at 71,1, 2nd node at 7,1
* 3rd node at 7,, (th node at 71,
*111111111111111111111111111111111111111111111111111111111111111111111111
* sha#e functions
sha#e$(7=0.25/71rvalue/71svalue
sha#e$(72=0.25/7
-
8/19/2019 Matlab.Mathematica Getting a Warning While Running the Program
20/28
* '&no#sis
* >acob2=fe>acob27nnel,dhdr,dhds,+coord,&coord
*
* )ariable Cescri#tion
* >acob2 1 ?acobian for one1dimension
* nnel 1 number of nodes #er element
* dhdr 1 derivative of sha#e functions !.r.t. natural coordinate r
* dhds 1 derivative of sha#e functions !.r.t. natural coordinate s
* +coord 1 + a+is coordinate values of nodes
* &coord 1 & a+is coordinate values of nodes
*111111111111111111111111111111111111111111111111111111111111111111111111
>acob2=6eros72,2
for i=nnel
>acob27,=>acob27,acob27,2=>acob27,2acob272,=>acob272,acob272,2=>acob272,2acob
*111111111111111111111111111111111111111111111111111111111111111111111111
* Pur#ose
* determine derivatives of 21C iso#arametric sha#e functions !ith
-
8/19/2019 Matlab.Mathematica Getting a Warning While Running the Program
21/28
* res#ect to #h&sical coordinate s&stem
*
* '&no#sis
* dhd+,dhd&=federiv27nnel,dhdr,dhds,inv>acob
*
* )ariable Cescri#tion
* dhd+ 1 derivative of sha#e function !.r.t. #h&sical coordinate +
* dhd& 1 derivative of sha#e function !.r.t. #h&sical coordinate &
* nnel 1 number of nodes #er element
* dhdr 1 derivative of sha#e functions !.r.t. natural coordinate r
* dhds 1 derivative of sha#e functions !.r.t. natural coordinate s
* inv>acob 1 inverse of 21C ?acobian matri+
*111111111111111111111111111111111111111111111111111111111111111111111111
for i=nnel
dhd+7i=inv>acob7,/dhdr7iacob7,2/dhds7i
dhd&7i=inv>acob72,/dhdr7iacob72,2/dhds7i
end
BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
function kinmtsb=fekinesb7nnel,dhd+,dhd&
*11111111111111111111111111111111111111111111111111111111111111111111111111
* Pur#ose
* determine the kinematic matri+ e+#ression relating bending curvatures
* to rotations and dis#lacements for shear deformable #late bending
-
8/19/2019 Matlab.Mathematica Getting a Warning While Running the Program
22/28
*
* '&no#sis
* kinmtsb=fekinesb7nnel,dhd+,dhd&
*
* )ariable Cescri#tion
* nnel 1 number of nodes #er element
* dhd+ 1 derivatives of sha#e functions !ith res#ect to +
* dhd& 1 derivatives of sha#e functions !ith res#ect to &
*11111111111111111111111111111111111111111111111111111111111111111111111111
for i=nnel
i=7i1/-
-
8/19/2019 Matlab.Mathematica Getting a Warning While Running the Program
23/28
function kinmtsm=fekinesm7nnel,dhd+,dhd&
*111111111111111111111111111111111111111111111111111111111111111111111111
* Pur#ose
* determine the kinematic e$uation bet!een strains and dis#lacements
* for t!o1dimensional solids
*
* '&no#sis
* kinmtsm=fekinesm7nnel,dhd+,dhd&
*
* )ariable Cescri#tion
* nnel 1 number of nodes #er element
* dhd+ 1 derivatives of sha#e functions !ith res#ect to +
* dhd& 1 derivatives of sha#e functions !ith res#ect to &
*111111111111111111111111111111111111111111111111111111111111111111111111
for i=nnel
i=7i1/-
-
8/19/2019 Matlab.Mathematica Getting a Warning While Running the Program
24/28
kinmtsm73,i=dhd&7i
kinmtsm73,i2=dhd+7i
kinmtsm73,i-=0.0
end
BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
function kinmtss=fekiness7nnel,dhd+,dhd&,sha#e
*111111111111111111111111111111111111111111111111111111111111111111111111
* Pur#ose
* determine the kinematic matri+ e+#ression relating shear strains
* to rotations and dis#lacements for shear deformable #late bending
*
* '&no#sis
* kinmtss=fekiness7nnel,dhd+,dhd&,sha#e
*
* )ariable Cescri#tion
* nnel 1 number of nodes #er element
* dhd+ 1 derivatives of sha#e functions !ith res#ect to +
* dhd& 1 derivatives of sha#e functions !ith res#ect to &
* sha#e 1 sha#e function
*111111111111111111111111111111111111111111111111111111111111111111111111
for i=nnel
i=7i1/-
-
8/19/2019 Matlab.Mathematica Getting a Warning While Running the Program
25/28
i3=i2
-
8/19/2019 Matlab.Mathematica Getting a Warning While Running the Program
26/28
* ndof 1 number of dofs #er node
*11111111111111111111111111111111111111111111111111111111111
edof = nnel/ndof
k=0
for i=nnel
start = 7nd7i1/ndof
for >=ndof
k=k
-
8/19/2019 Matlab.Mathematica Getting a Warning While Running the Program
27/28
* inde+ 1 d.o.f. vector associated !ith an element
*11111111111111111111111111111111111111111111111111111111111
edof = length7inde+
for i=edof
ii=inde+7i
for >=edof
>>=inde+7>
kk7ii,>>=kk7ii,>>
end
end
________________________________________________________________________
function kk,ff=fea#l&c27kk,ff,bcdof,bcval
*1111111111111111111111111111111111111111111111111111111111
* Pur#ose
* A##l& constraints to matri+ e$uation kkI+J=IffJ
*
* '&no#sis
* kk,ff=fea#l&bc7kk,ff,bcdof,bcval
*
* )ariable Cescri#tion
* kk 1 s&stem matri+ before a##l&ing constraints
* ff 1 s&stem vector before a##l&ing constraints
* bcdof 1 a vector containging constrained d.o.f
-
8/19/2019 Matlab.Mathematica Getting a Warning While Running the Program
28/28
* bcval 1 a vector containing contained value
*
* Kor e+am#le, there are constraints at d.o.f=2 and 0
* and their constrained values are 0.0 and 2.5,
* res#ectivel&. %hen, bcdof7=2 and bcdof72=0 and
* bcval7=.0 and bcval72=2.5.
*11111111111111111111111111111111111111111111111111111111111
n=length7bcdof
sdof=si6e7kk
for i=n
c=bcdof7i
for >=sdof
kk7c,>=0
end
kk7c,c= ff7c=bcval7i endBBBBBBBB