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 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Easwar Kumar Yarrabikki
le 19 Jan 2017
Modifié(e) : Easwar Kumar Yarrabikki
le 20 Jan 2017
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 commentaires
Réponse acceptée
Easwar Kumar Yarrabikki
le 20 Jan 2017
Modifié(e) : Easwar Kumar Yarrabikki
le 20 Jan 2017
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Ordinary Differential Equations dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!