Numeric solution of differential equation system
Show older comments
I need to solve system which has the form:
A*diff (chi1(r), r, 2) + B*chi1(r)+ D*chi2(r) = Q(r)
E*diff (chi2(r), r, 2) + F*chi2(r)+ G*chi1(r) = 0
with boundary conditions: chi1(0) = 0, chi1(1000) = 0, chi2(0) = 0, chi2(1000) = 0
I wrote next code, but nothing works. Help me please!
function soleq
global sol
clc
solinit = bvpinit(linspace(0,12),[0 1000]);
sol = bvp4c(@ode4,@bc2,solinit);
plot(sol.x, sol.y), grid on
legend('y(t)','dy(t)')
xlabel('t')
end
function du = ode4(t,u)
mp = 938.2720813; mn = 939.5654133; hbar = 197.3270533;
V0 = 20; EIm = 0.3; mu = (mn+mp)*(1/4); Q0 = 1.5; Rq = 4.5; Rv = 1.5; ERe =1;
du = [((-2*mu*t*Q0*exp(-t/Rq)+2*mu*(-V0*exp(-t/Rv)-ERe)*u(3)+2*mu*EIm*u(4))/hbar^2); -(2*mu/hbar^2)*((ERe+V0*exp(-t/Rv))*u(4)+EIm*u(3));
u(1); u(2)];
end
function res=bc2(ua,ub)
res = [ ua(3) ; ub(3) ;
ua(4) ; ub(4) ];
end
Answers (0)
Categories
Find more on Equation Solving in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!