Problem in converting expression into double array and error in converting from sym to double
Mostrar comentarios más antiguos
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 comentarios
madhan ravi
el 12 de Abr. de 2019
What should be the final size?
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Conversion Between Symbolic and Numeric en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!