error using integral function
이전 댓글 표시
hi everybody,i`m trying to execute this code...
syms x f(x)
f(x)=exp((-x.^2)/2)
f_matlab = matlabFunction(f(x))
v1 = integral(f_matlab,1,2)
but when i do it, i get this problem
Unable to use a value of type function_handle as an index.
Error in (name of script) (line 55)
v1 = integral(f_matlab,1,2)
Does anyone know how to solve it?
채택된 답변
추가 답변 (1개)
David Hill
2020년 5월 5일
Looks like you are trying to do numerical integration, then no need for symbolic variables.
f=@(x)exp(-x.^2/2);
v=integral(f,1,2);
카테고리
도움말 센터 및 File Exchange에서 Calculus에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!