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

per isakson
per isakson 2014년 8월 28일
편집: per isakson 2014년 8월 28일
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 2014년 8월 28일
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
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 2014년 8월 29일
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.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

도움말 센터File Exchange에서 Logical에 대해 자세히 알아보기

태그

질문:

2014년 8월 28일

편집:

2014년 8월 29일

Community Treasure Hunt

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

Start Hunting!

Translated by