function with xmin causes error
조회 수: 17 (최근 30일)
이전 댓글 표시
I am supposed to create xmin as a function but no matter what I try MatLab always displays:
Error using minfun
Too many input arguments.
My code looks like this:
function xmin=minfun(x)
n=length(x);
xmin=x1;
for k=2:n
if (x(k)<xmin)
xmin=x(k);
end
end
end
I really have no idea where I made a mistake...
댓글 수: 0
채택된 답변
Walter Roberson
2017년 3월 30일
The problem is in how you execute the function. You need to go to the command line and type in the function name and the input argument. For example,
minfun([pi exp(2) sqrt(5)])
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Digital Filtering에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!