私はpython、numpy、scipyを学んでいます。matlab のこの種の関数を Python に変換できるかどうか疑問に思っています。
function [tT, u ] = SSolve5TH(n, t, t0,tf,u_env,utop_init, utop_final,ubottom,te_idx)
options = [];
[tT,u] = ode23s(@SS,t,u_env,options,@B);
function y = B(x)
y = zeros(n,1);
if x >= t(te_idx)
y(1,1) = utop_final;
y(n,1) = ubottom ;
else
y(1,1) = (x - t0) / ( tf - t0) * (utop_final - utop_init) + utop_init;
y(n,1) = ubottom ;
end
end
function rp = SS(t,r,B)
global AH
rp = AH * r + B(t);
end
end
この例では、n は数値で、たとえば 15 です。
t は時間配列です
AH = [15]xt 行列
t0 = 0
tf = 20 (例)
u_env = [20,20,20,20,20,20,20,20,20,20,20,20,20,20,20]
utop_init = 20
utop_final = 40; 下 = 20;
te_idx = 4;