Problem in converting expression into double array and error in converting from sym to double
이전 댓글 표시
Hi,
I have written a code to get Lagrange Interpolation functions used in FInite element analysis. Below is the code.
% lagrange interpolation functions
syms r;
r_e=input('enter the natural co-ordinate values of r in the order of nodes as row vector=');
for i=1:length(r_e)
for j=1:length(r_e)
if j~=i
N_R(j)=((r-r_e(j)))/(r_e(i)-r_e(j));
else
N_R(j)=1;
end
end
N_r(i)=prod(N);
end
But it shows these error when i enter the inputs!
enter the natural co-ordinate values of r in the order of nodes as row vector=[-1 1]
The following error occurred converting from sym to double:
Unable to convert expression into double array.
Error in lagrange (line 8)
N_R(j)=((r-r_e(j)))/(r_e(i)-r_e(j));
Please suggest me a solution.
댓글 수: 2
madhan ravi
2019년 4월 12일
What should be the final size?
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Conversion Between Symbolic and Numeric에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!