How can I call a function (with all its parameters) using another function?
10 ビュー (過去 30 日間)
古いコメントを表示
I have defined the following function: (part of the code is omitted for simplicity)
function [t,y]= backEulerfedbatchSystem(rhs,drhs,x0,t0,tf,n)
In particular the parameter "rhs" is also a function defined by:
function dxdt = FedbatchFermenterModel(t,x,u,d,par)
When I call this function in this way:
backEulerfedbatchSystem(FedbatchFermenterModel,drhs,x0,t0,tf,n)
An error occurs. FedbatchFermenterModel cannot be computed because it lacks its parameters (t,x,u,d,par). How can I call the function FedbatchFermenterModel (with all its parameters) using backEulerfedbatchSystem? Any hint will be appreciated !
0 件のコメント
採用された回答
Walter Roberson
2013 年 3 月 5 日
backEulerfedbatchSystem(@FedbatchFermenterModel, drhs, x0, t0, tf, n)
then inside the function,
rhs(t, x, u, d, par)
but you have to figure out u, d, par inside backEulerfedbatchSystem.
Are those parameters possibly known at the time backEulerfedbatchSystem is being called? If so, then
backEulerfedbatchSystem(@(t, x) FedbatchFermenterModel(t, x, u, d, par), drhs, x0, t0, tf, n)
and then inside the function,
rhs(t, x)
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Manage Products についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!