not enough input arguments when using function functions.
조회 수: 2 (최근 30일)
이전 댓글 표시
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1714091/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1714096/image.png)
Hi, when I call heun(u0,n,dt,f), the error is:
Not enough input arguments.
Error in f (line 7)
mat = zeros(n);
Any ideas why? It's like the f function hasn't even read the parameters I put into it.
Thanks.
댓글 수: 2
답변 (1개)
Ganesh
2024년 6월 12일
편집: Ganesh
2024년 6월 12일
The error is occuring as you are likely not passing "f" as a "function handle".
You can try calling "heun(u0,n,dt,@f)" instead.
When passing functions as arguments to another function, it is important to pass it as a function handle always. You can find more on "function handles" from the following documentation:
Edit - I just saw @Stephen23 has already answered it in comments, apologies for a repetitive answer.
댓글 수: 2
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!