Read time variable parameter values in an ode-solver loop
Mostrar comentarios más antiguos
I have a function "solver" with a ode-solver that solves the differential equations of the function "funktion" for defined time steps. In the function "funktion" there are also the "parameters" Qc, Tc and Fc. These parameters are read from an excel file at the beginning. For every time step there is another value for these three parameters. So I want that the ode solver uses for every time step the accompanying parameter value. I tried to write in the function "funktion" that matlab has to use the value of "parameters" of the excel line t, but it doesn´t work.
What can I change to solve my problem?
Below I wrote the main important matlab codes.
feed.xlsx:
t Qc Fc Tc (this line is not in the excel file)
0 200 12 12
0,5 0 0 0
1 200 12 12
parameters = xlsread('feed.xlsx');
function [cumgas comp frac] = solver(parameters)
tspan = [0:(1/48):23];
options = odeset('RelTol',1e-3,'AbsTol',1e-6);
[t,X] = ode15s(@funktion,tspan,Xo,options,parameters);
function [adm_dt] = funktion(t,fractions,parameters)
Qc = parameters(t,1);
Tc = parameters(t,2);
Fc = parameters(t,3);
dSI = + (fSI_XC) * (kdis*Xc);
dSI = dSI + Qc * 0.003;
1 comentario
Lena
el 5 de Abr. de 2018
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Loops and Conditional Statements en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!