Numerically solving first-order integro-differential equation

2 ビュー (過去 30 日間)
AHMAD TALAEI
AHMAD TALAEI 2020 年 11 月 13 日
編集済み: AHMAD TALAEI 2020 年 11 月 13 日
Can anyone help me solve the following equation numerically:
where a = 8, b = 5.3e+04, c = 22, d = 2, e = 100, and v(0) = eps.
I wrote the following code for t in the range 0 to 1, but there is an error with the integral term.
clear all
clc
syms v_p(t) t
eqn(1) = diff(v_p,1) == -8 - CD(v_p)*abs(v_p)*v_p - 5.3e4*Int(v_p,t);
pretty(eqn)
[V] = odeToVectorField(eqn);
fun = matlabFunction(V,'Vars', {'t','Y'});
tInterval = [0 1];
vInit = [eps];
vSol = ode45(fun,tInterval,vInit);
tValues = linspace(tInterval(1),tInterval(2),100);
vValues(1:length(tValues)) = deval(vSol,tValues,1);
plot(tValues,-vValues)
function getCD = CD(v_p)
getCD = 22 + 2/abs(v_p) + 100/(1+sqrt(abs(v_p)));
end
function getInt = Int(v_p,t)
T = linspace(0,t);
Int_diff = zeros(1, length(T));
for i = 1:length(T)
[~, y] = ode45(@(s,y) diff(v_p,s)/sqrt(T(i)-s), [0 T(i)+eps], eps);
Int_diff(i) = y(end);
end
getInt = Int_diff(end)
end

回答 (0 件)

カテゴリ

Help Center および File ExchangeCalculus についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by