Too many inputs to inline function

1 回表示 (過去 30 日間)
Pramit Biswas
Pramit Biswas 2013 年 6 月 19 日
編集済み: Anay Aggarwal 2022 年 7 月 12 日
fcnstr=input('Put Desired Function: dy/dx=', 's') ; f=inline(fcnstr) ;
x0=input('x(0)=') ;
y0=input('y(0)=') ;
xf=input('x(f)=') ;
n=2 ;
h=(xf-x0)/n
%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
format long g
xa(1)=x0 ;
ya(1)=y0 ;
for i=1:n
xa(i+1)=xa(i)+h ;
k1 = h*f(xa(i),ya(i));
gives error:
"??? Error using ==> inline.subsref at 17
Too many inputs to inline function.
Error in ==> FODESu4oRKv1 at 43
k1 = h*f(xa(i),ya(i));"
  1 件のコメント
Pramit Biswas
Pramit Biswas 2013 年 6 月 19 日
well i used this
x0=input(sprintf('x(0)=', '%g'))

サインインしてコメントする。

回答 (1 件)

Anay Aggarwal
Anay Aggarwal 2022 年 7 月 10 日
編集済み: Anay Aggarwal 2022 年 7 月 12 日
Hi Pramit
I have an understanding that you want to make use of the inline function in your code; but you are not able to and it is giving an error "Too many inputs to inline function".
You need to specify the variables (and the order of the variables) explicitly when you use inline().
See the bottom example in the reference page:
Regards

カテゴリ

Help Center および File ExchangeFunction Creation についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by