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!