필터 지우기
필터 지우기

feval problem Too many inputs to inline function.

조회 수: 2 (최근 30일)
adem ski
adem ski 2019년 12월 4일
답변: Walter Roberson 2022년 2월 26일
a=0
b=2
y=5
x=1/2
f1=inline('(1+x^2)/(sqrt(x)+3)')
f2=inline('(1+x^2)/(sqrt(x)+3)')
f3=inline('(1+x^2)/(sqrt(x)+3)')
f4=inline('(1+x^2)/(sqrt(x)+3)')
f1=feval(f1,x)
f2=feval(f2,a,b,x)
f3=feval(f3,x,y)
f4=feval(f4,a,x,b,y)
i see this problem
??? Error using ==> inline.feval at 26
Too many inputs to inline function.
Too many inputs to inline function.
Error in ==> Untitled3 at 10
f2=feval(f2,a,b,x)
how can i fix it

답변 (2개)

JESUS DAVID ARIZA ROYETH
JESUS DAVID ARIZA ROYETH 2019년 12월 4일
a=0
b=2
y=5
x=1/2
f1=inline('(1+x^2)/(sqrt(x)+3)')
f2=inline('(1+x^2)/(sqrt(x)+3)')
f3=inline('(1+x^2)/(sqrt(x)+3)')
f4=inline('(1+x^2)/(sqrt(x)+3)')
f1=f1(x)
f2=f2(x)
f3=f3(x)
f4=f4(x)
But inline will be removed in a future release. Use Anonymous Functions instead:
x=1/2;
f1=@(x) (1+x^2)/(sqrt(x)+3);
f1value=f1(x)

Walter Roberson
Walter Roberson 2022년 2월 26일
When you use inline() [which should be only if you have a need to prove that you can use inline], then you should define all of the variables you expect to use in the function, and their order.
a=0
a = 0
b=2
b = 2
y=5
y = 5
x=1/2
x = 0.5000
f1=inline('(1+x^2)/(sqrt(x)+3)', 'x')
f1 = Inline function: f1(x) = (1+x^2)/(sqrt(x)+3)
f2=inline('(1+x^2)/(sqrt(x)+3)', 'a', 'b', 'x')
f2 = Inline function: f2(a,b,x) = (1+x^2)/(sqrt(x)+3)
f3=inline('(1+x^2)/(sqrt(x)+3)', 'x', 'y')
f3 = Inline function: f3(x,y) = (1+x^2)/(sqrt(x)+3)
f4=inline('(1+x^2)/(sqrt(x)+3)', 'a', 'x', 'b', 'y')
f4 = Inline function: f4(a,x,b,y) = (1+x^2)/(sqrt(x)+3)
f1=feval(f1,x)
f1 = 0.3372
f2=feval(f2,a,b,x)
f2 = 0.3372
f3=feval(f3,x,y)
f3 = 0.3372
f4=feval(f4,a,x,b,y)
f4 = 0.3372

카테고리

Help CenterFile Exchange에서 Function Creation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by