필터 지우기
필터 지우기

pchip vector in ODE45 equation

조회 수: 2 (최근 30일)
Philip Berg
Philip Berg 2016년 10월 18일
댓글: Philip Berg 2016년 10월 18일
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!

채택된 답변

Torsten
Torsten 2016년 10월 18일
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.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Ordinary Differential Equations에 대해 자세히 알아보기

제품

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by