to remove the error in this line of code "[T,Y] = ode45(@(t,y) intgrl(t,y​,u),tspan,​yo,options​);"

2 ビュー (過去 30 日間)
i am trying to solve the optimization problem by using function but i am getting an error in it.
function f=bench_func(x)
[ps,d]=size(x);
% The optimal control of a non-linear stirred tank reactor.
tol=1.0e-01;
tspan=[0 0.78];
yo =[0.09 0.09]';
u=x; %u should be passed here.
options = odeset('RelTol',tol);
[T,Y] = ode45(@(t,y) intgrl(t,y,u),tspan,yo,options);
f=sum(sum(Y.^2,2)+(0.1)*(u).*(u));
error
Error in bench_func (line 141)
[T,Y] = ode45(@(t,y) intgrl(t,y,u),tspan,yo,options);
please help me to solve this error.

採用された回答

Walter Roberson
Walter Roberson 2015 年 8 月 31 日
It appears that intgrl might be http://www.mathworks.com/matlabcentral/fileexchange/2268-projects-for-scientists-and-engineers/content/penland/intgrl.m from the File Exchange. Have you installed that package and added it to your MATLAB path?
We need the full error message that you received.
  2 件のコメント
Muhammad Umer
Muhammad Umer 2015 年 8 月 31 日
編集済み: Muhammad Umer 2015 年 8 月 31 日
thanks for your response. i have not installed this "intgrl" package. how can i install this package to run this code?
Walter Roberson
Walter Roberson 2015 年 8 月 31 日
Go to the above link and on the upper right side of the page click on Download ZIP. Save that file and unzip the contents into a user directory. Then go into MATLAB and use pathtool to add that directory to the MATLAB path.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeIntroduction to Installation and Licensing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by