필터 지우기
필터 지우기

Not enough input arguments: fminbnd

조회 수: 2 (최근 30일)
Devdatt Thengdi
Devdatt Thengdi 2017년 8월 28일
댓글: Stephen23 2017년 9월 4일
Function file:
function fun = SinExample(x,x1,x2)
x1 = 0;
x2 = 2.*3.14178;
fun = sin(x);
Solution File:
x1 = 0;
x2 = 2.*3.14178;
fun = fminbnd(@SinExample,x1,x2);
I am a beginner and this is a simple example file solving for sin(x). It just says, "Too many input arguments," in line 5 i.e. "fun = fminbnd(@SinExample,x1,x2)." Tried to execute with only the function file:
function fun = SinExample(x,x1,x2)
x1 = 0;
x2 = 2.*3.14178;
fun = sin(x);
fun = fminbnd(@SinExample,x1,x2);
Error-"Not enough input arguments," in line 4 i.e. "fun = sin(x)".
Please yelp.

답변 (1개)

KSSV
KSSV 2017년 8월 28일
fun = @sin;
x1 = 0;
x2 = 2.*3.14178 ;
x = fminbnd(fun,x1,x2)
  댓글 수: 5
Devdatt Thengdi
Devdatt Thengdi 2017년 9월 4일
The Problem's been resolved. But, Could any of you provide me with a editor code for fminbnd sin. And What do we do if we are getting arguement errors as specified as above?
Stephen23
Stephen23 2017년 9월 4일
"Could any of you provide me with a editor code for fminbnd sin"
KSSV already did.
"And What do we do if we are getting arguement errors as specified as above?"
Restart MATLAB and do not name variables or functions with the names of any inbuilt MATLAB functions.

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

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by