Why do I get an error message with the following piece of script? Everything seems OK (I use R2014a by the way)
func=@(x) exp(x^2)/(x^0.5)
func =
@(x)exp(x^2)/(x^0.5)
>> integral(func,0,1)
Error using integral
Too many input arguments.
>>

 채택된 답변

VBBV
VBBV 2022년 12월 11일
편집: VBBV 2022년 12월 11일
May be you have function defined with a name integral. Check the working folder where you might have such function and which takes few input arguments (<=2)
func=@(x) exp(x.^2)./(x.^0.5)
func = function_handle with value:
@(x)exp(x.^2)./(x.^0.5)
integral(func,0,1)
ans = 2.5426

댓글 수: 1

Ali Kiral
Ali Kiral 2022년 12월 11일
You're right, I realized I had a function m-file (with a name integral) lurking in the working folder. It accepted one input. Now it's history:)

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

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

제품

릴리스

R2014a

태그

질문:

2022년 12월 11일

댓글:

2022년 12월 11일

Community Treasure Hunt

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

Start Hunting!

Translated by