feval problem Too many inputs to inline function.
1 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
回答(2 个)
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)
x=1/2;
f1=@(x) (1+x^2)/(sqrt(x)+3);
f1value=f1(x)
0 个评论
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
b=2
y=5
x=1/2
f1=inline('(1+x^2)/(sqrt(x)+3)', 'x')
f2=inline('(1+x^2)/(sqrt(x)+3)', 'a', 'b', 'x')
f3=inline('(1+x^2)/(sqrt(x)+3)', 'x', 'y')
f4=inline('(1+x^2)/(sqrt(x)+3)', 'a', 'x', 'b', 'y')
f1=feval(f1,x)
f2=feval(f2,a,b,x)
f3=feval(f3,x,y)
f4=feval(f4,a,x,b,y)
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Function Creation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!