How to return specific array elements from matlab function?

3 ビュー (過去 30 日間)
pgs11002
pgs11002 2013 年 3 月 7 日
Hello everyone
I want to make an algorithm in matlab (function). I want this function to take an input of three values (time, position and speed) and return an array of optimal controls u(t), u(t+1),...,u(T)
My problem is how to declare the function and ask from it to give to me a part of an array. The array will have the optimal cntrol for all combinations of t,x,v. Since we give our triplette t,x,v we want to get the array elements for optimal control from time t until final time T. Does anyone know how to do it?
Thank you

採用された回答

Matt J
Matt J 2013 年 3 月 7 日
編集済み: Matt J 2013 年 3 月 7 日
function out=myfunc(x,t,v,T)
u=...%code to create u
out=u(t:T);

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGet Started with Optimization Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by