getting NaN as result

Dear MATLAB helpers,
I'm trying to run a project for 2 month but I think the problem is bad scaling.
this is the code :
K=zeros(15);
for i=1:4
Ke=bar3e(Ex(i,:),Ey(i,:),Ez(i,:),[E Ep(i,1)]);
K=assem(Edof(i,:),K,Ke);
end
Also I attached bar3e function, assem and variables value such as E , it may help.
I will be thankful for any suggestion.
All the best

4 comentarios

per isakson
per isakson el 28 de Ag. de 2014
Editada: per isakson el 28 de Ag. de 2014
Which are the steps needed to reproduce your problem?
>> [Ke]=bar3e(ex,ey,ez,ep)
Undefined function or variable 'ex'.
>> [K,f]=assem(edof,K,Ke,f,fe)
Undefined function or variable 'edof'.
Hessam
Hessam el 28 de Ag. de 2014
The above code is a part of my project, all the functions or variables are defined.
my whole project is attached.
I get warning Matrix is singular, close to singular or badly scaled every time and this is because of getting NaN as result for K, Ke.
thank you
Fabio Freschi
Fabio Freschi el 28 de Ag. de 2014
Unfortunately I can't do some tests myself. Anyway, I have an idea. My guess is that you are trying to solve a FEM problem or similar and you are not applying constraints (or boundary conditions) to the stiffness matrix. To check if I am right, remove one row and one column from the stiffness matrix and rhs and solve the problem. This is equivalent to set an unknown to 0. For example:
% this is the unknown we want to fix to 0
ifix = 1;
% tis is not very efficient but simple!
K(ifix,:) = []; % remove row
K(:,ifix) = []; % remove col
f(ifix) = []; % rhs
% solve. The solution might be meaningless, but the system is now
% constrained and you should not have singularities anymore
x = K\f;
If this works you can try to apply meaningful boundary conditions to your system.
Let us know!
Fabio
Hessam
Hessam el 29 de Ag. de 2014
Thank you Fabio, I like your idea.
I did what you said but it leads to this error :
Index exceeds matrix dimensions.
Error in extract
ed(i,1:(n-1))=a(t(i,:))';
Error in FEM2
Ed=extract(Edof,a);
What should I do now??
I'm so confused, I couldn't solve this warning for a long time.
Thanks.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Etiquetas

Preguntada:

el 28 de Ag. de 2014

Editada:

el 29 de Ag. de 2014

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by