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 CenterFile Exchange에서 Calculus에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by