Problem in converting expression into double array and error in converting from sym to double
Show older comments
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 Comments
madhan ravi
on 12 Apr 2019
What should be the final size?
Accepted Answer
More Answers (0)
Categories
Find more on Conversion Between Symbolic and Numeric in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!