During compiling came across error 'too many input arguments'

1 回表示 (過去 30 日間)
SHIJINA P P
SHIJINA P P 2016 年 5 月 24 日
回答済み: SHIJINA P P 2016 年 5 月 25 日
Program is solving second order differential equation using fourth order runga kutta method. Sliding mode control program is used as the controller. Error in line 15.

採用された回答

Walter Roberson
Walter Roberson 2016 年 5 月 24 日
You should get rid of the "clear all": it can only cause you problems inside functions.
Your line 15 has
control(state,time)
which shows the routine named control called with a state and a time. But further down you define the function control as taking a single argument named x not with two arguments.
  4 件のコメント
SHIJINA P P
SHIJINA P P 2016 年 5 月 24 日
Here it is.
Walter Roberson
Walter Roberson 2016 年 5 月 24 日
Your code passes time to Derivatives but Derivatives does not expect a second argument.
You are not using time in Derivatives so you probably do not need to pass it if your Derivatives routine is correct.
I see in your revised code that in your first call to control, you pass the entire vector of time but in all your other calls to control you pass only a variant of the current time, such as time(idx) plus something. This is inconsistent and hints at a logic error in your code.
On the other hand, your control function ignores the time that it is being passed so there is no point in passing the time if your control routine is correct.

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

その他の回答 (1 件)

SHIJINA P P
SHIJINA P P 2016 年 5 月 25 日
I got it, Thank you sir.

カテゴリ

Help Center および File ExchangeNumerical Integration and Differential Equations についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by