First Initialized Vector Y as Y=zeros(100x48). Also introduced Coder.varsize('Y',[1000 48],[1 0]). Coder.varsize will allow Y to change its size according to result during simulation. It does worked out for me. for more details on to use coder.varsize look at coder.varsize
How Can I store results from Variable step solver(ODE15s) to a Pre-initialized variable
1 次查看(过去 30 天)
显示 更早的评论
Easwar Kumar Yarrabikki
2017-1-19
编辑: Easwar Kumar Yarrabikki
2017-1-20
Hello All, I have been working on a problem which using ODE15s solver and anonymous function . I have used Coder.extrinsic(myfunction) in my MATLAB code in order to avoid issues while codegen. So I need to pre-Initialize a variable to store results from myfunction. My Coder.extrinsic(myfunction) has following code.
[T,Y] = ode15s(@(t,y) fn_diffeq(t,y,a,b,b,d,e,f,g,h,i,j), [0,time],k);
The size of Y will change according to input conditions to ODE15s Solver. it might be 100x40 for first iteration, 200x40 for second iteration and 10x40 for third iteration and etc.
I am looking for a way to Pre-initialize a variable to store this result vector.
Can Someone please help me to figure out a way to implement this problem.
Thanks in advance. Easwar
0 个评论
采纳的回答
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Ordinary Differential Equations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!