Hi,
I want t slve a Numerical Integral fOr Leonard-johnes Potential
How can I Solve this error ?
Fun=@(x,t)(x^2*(exp(-((1/(x^12))-(1/x^6))/t))-1));
Q=integral(@(x)Fun(x,10),0,2)
Error In integral
I Also need to plot Q in different t
Do You Have Any Comments ?

 채택된 답변

madhan ravi
madhan ravi 2019년 1월 17일
편집: madhan ravi 2019년 1월 17일

0 개 추천

syms t x % at the very beginning
%remove @(x,t) and replace it with matlabFunction()

추가 답변 (1개)

Walter Roberson
Walter Roberson 2019년 1월 17일

1 개 추천

Fun=@(x,t) x.^2.*(exp(-((1./(x.^12))-(1./x.^6))./t))-1
You had too many ) and you needed to vectorize. integral() always invokes the function with a vector of values rather than just a single value.

카테고리

도움말 센터File Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by