pchip vector in ODE45 equation
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Philip Berg
am 18 Okt. 2016
Kommentiert: Philip Berg
am 18 Okt. 2016
Hello, I'm currently trying to make a script that takes some variable x, with some parameters p, and a fitted curve z (fitted with
FLM_Beta12 = pchip(Data(:,1),x(:,5),tSpan)
). tSpan is the first time point in the data (=ts) to the last one (=te), and looks like ts:0.01:te, Data is a column of the actual time points of measurement, and x is the measurements.
The ODE function is as follows:
function dFTdt = Beta(t,x,p,z)
FT=x(1);
alpha = p(1);
beta = p(2);
ki=p(3);
FLM_Beta = z;
dFTdt = zeros(1,1);
dFTdt(1) = beta - FLM_Beta(t) * ki - FT * alpha;
end
For some reason when I debug the script t is always a 1x1 matrix (with the value 1). And this is how I call the ODE:
[~,yx] = ode45(@(t,x) Beta12(t,x,parameters,FLM_Beta),tSpan,FT12(1))
Where parameters is a row vector of 3 values. FT is a column vector with data. I have been trying a lot of different ways to call it, but I think the issue is with the fitted curve and that 'FLM_Beta(t)' isn't calling one value at the time. Any help, or a link in the right direction is very welcome. If I haven't provided enough details of the problem, please let me know!
0 Kommentare
Akzeptierte Antwort
Torsten
am 18 Okt. 2016
FLM_Beta12 = pchip(Data(:,1),x(:,5));
[~,yx] = ode45(@(t,x) Beta(t,x,parameters,FLM_Beta12),tSpan,FT12(1));
function dFTdt = Beta(t,x,p,z)
FT=x(1);
alpha = p(1);
beta = p(2);
ki = p(3);
FLM_Beta = z;
dFTdt = zeros(1,1);
dFTdt(1) = beta - ppval(FLM_Beta,t) * ki - FT * alpha;
end
Best wishes
Torsten.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Ordinary Differential Equations finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!