Error in my FEM Matlab code. Please help

for i=1:2
fepsn(i)=i;
end
%%Loop for epsilon values
for icounter=1:2
epsn=fepsn(icounter)
end
%%Shape function for axial effect
N1(epsn)=(-1/2)*epsn*(1-epsn)
N2(epsn)=(1+epsn)*(1-epsn)
N3(epsn)=(1/2)*epsn*(1+epsn)
syms epsn
%%First Derivatives of Shape Function
N1=diff(N1(epsn),epsn) (Error here)
N2=diff(N2(epsn),epsn)
N3=diff(N3(epsn),epsn)
%%%%Second Derivatives of Shape Function
N11=diff(N1(epsn));
N22=diff(N2(epsn));
N33=diff(N3(epsn));

댓글 수: 8

KSSV
KSSV 2018년 10월 4일
What error? How do you think without specifying error, error line and all variables you will get help?
Virajan Verma
Virajan Verma 2018년 10월 4일
Error using sym/subsindex (line 732) Invalid indexing or function definition. When defining a function, ensure that the arguments are symbolic variables and the body of the function is a SYM expression. When indexing, the input must be numeric, logical, or ':'.
Error in xz (line 21) N1=diff(N1(epsn),epsn)
Virajan Verma
Virajan Verma 2018년 10월 4일
error(message('symbolic:sym:subscript:InvalidIndexOrFunction'));
madhan ravi
madhan ravi 2018년 10월 4일
Remove syms epsn line
Virajan Verma
Virajan Verma 2018년 10월 4일
I have removed that line and a new error has come. Attempted to access N1(2); index out of bounds because numel(N1)=0.
Error in xz (line 26) N11=diff(N1(epsn));
KSSV
KSSV 2018년 10월 4일
Why you are using sym to code FEM?
Virajan Verma
Virajan Verma 2018년 10월 4일
I have removed it now. But error is there as stated in my previous comment
syms epsn N1(epsn) N2(epsn) N3(epsn)
N1(epsn) = (-1/2)*epsn*(1-epsn);
N2(epsn) = (1+epsn)*(1-epsn);
N3(epsn) = (1/2)*epsn*(1+epsn);
DN1 = diff(N1,epsn);
DN2 = diff(N2,epsn);
DN3 = diff(N3,epsn);
D2N1 = diff(DN1,epsn);
D2N2 = diff(DN2,epsn);
D2N3 = diff(DN3,epsn);

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

답변 (1개)

카테고리

태그

질문:

2018년 10월 4일

댓글:

2018년 10월 4일

Community Treasure Hunt

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

Start Hunting!

Translated by