Numerically solving first-order integro-differential equation

1 次查看(过去 30 天)
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 中查找有关 Ordinary Differential Equations 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by