Read time variable parameter values in an ode-solver loop
显示 更早的评论
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;
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Loops and Conditional Statements 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!