%------------------------------------% input data for control parameters%------------------------------------

clearnel=25; % number of elementsnnel=4; % number of nodes per elementndof=6; % number of dofs per nodennode=36; % total number of nodes in systemsdof=nnode*ndof; % total system dofs edof=nnel*ndof; % degrees of freedom per elementemodule=10.5e6; % elastic moduluspoisson=0.3125; % Poisson's ratiothick=0.094; % shell thicknessnglx=1; ngly=1; nglz=2; % 1x1x2 Gauss-Legendre quadrature ngl=nglx*ngly*nglz; % number of sampling points per element

if v3(2) > 0.999999 % if v3 is along the y-axis, v1 is set along x-axisv1(1)=1.0;v1(2)=0.0;v1(3)=0.0;else % otherwise, v1 is the cross product of y-axis and v3v1(1)=v3(3);v1(2)=0.0;v1(3)=-v3(1);sum=sqrt(v1(1)^2+v1(2)^2+v1(3)^2); v1(1)=v1(1)/sum; % make vector v1 a unit vectorv1(2)=v1(2)/sum;v1(3)=v1(3)/sum;end

for i=1:nnelderivg(1,i)=ajinv(1,1)*dhdr(i)+ajinv(1,2)*dhds(i);derivg(2,i)=ajinv(2,1)*dhdr(i)+ajinv(2,2)*dhds(i);derivg(3,i)=ajinv(3,1)*dhdr(i)+ajinv(3,2)*dhds(i);dhdz(1,i)=ajinv(1,3)*hzdt;dhdz(2,i)=ajinv(2,3)*hzdt;dhdz(3,i)=ajinv(3,3)*hzdt;end

>> oriWarning: The value of local variables may have been changed to match the globals. Future versions of MATLAB will require that you declare a variable to be global before you use that variable.> In feeldof at 3 In ori at 455Warning: The value of local variables may have been changed to match the globals. Future versions of MATLAB will require that you declare a variable to be global before you use that variable.> In feeldof at 3 In ori at 455Warning: The value of local variables may have been changed to match the globals. Future versions of MATLAB will require that you declare a variable to be global before you use that variable.> In feeldof at 3 In ori at 455

I would be glag if you could debug the code. This code is about obtaining deflection results by the Finite Element Method using a method called "Matrix Displacement method"

regards,Hugo

"Steven_Lord" <slord@mathworks.com> wrote in message <kenc6p$m5r$1@newscl01ah.mathworks.com>...> > > "Hugo " <hugolopessilva@gmail.com> wrote in message > news:kejmtf$igm$1@newscl01ah.mathworks.com...> > Hello, I am trying to obtain deflection results on a beam made with shell > > elements> >> > I wrote a MATLAB code. The problem is that kk is a matrix with 3000*3000 > > full of zeros (its a singular matrix), and it is not supposed to be.> > The code runs well until I call the function feasmbl1.m, which is shown > > next> > *snip*> > No one will be able to debug this without your data. That means that you're > going to have to be the one to step through your code (ideally on a SMALLER > problem, one that you can work out on paper) to determine why it doesn't > return the results you expect (or determine why your expectations are > incorrect.)> > I will suggest that you may want to use the ACCUMARRAY or SPARSE functions > to perform your accumulation instead of building your own function.> > -- > Steve Lord> slord@mathworks.com> To contact Technical Support use the Contact Us link on > http://www.mathworks.com