Integrating second order differential equation BVP error

2 次查看(过去 30 天)
I get the error "Warning: Explicit solution could not be found." when trying to integrate this BVP.
I've attached a picture of the DE here.
https://imgur.com/a/j6eJERx
Why is it failing?
syms y(x)
epsilon = .0001
ode = epsilon*diff(y,x,2)-(3*x+2)*diff(y,x)+y^2 == 0;
cond1 = y(0) == -3/log(2);
cond2 = y(1) == 1;
conds = [cond1 cond2];
ySol(x) = dsolve(ode,conds)
end

采纳的回答

Stephan
Stephan 2018-11-1
编辑:Stephan 2018-11-1
Hi,
i dont think that there is a analytical solution to this problem. You can solve this numeric by using symbolic Toolbox for creating a function handle to this in the first step (or you do this by hand):
syms y(x)
epsilon = .0001
ode = odeToVectorField((epsilon*diff(y,x,2)-(3*x+2)*diff(y,x)+y^2 == 0),y(x));
ode_fun = matlabFunction(ode,'Vars',{'x','Y'})
The code above gives you a system of first order odes and a function handle:
ode =
Y[2]
10000*(3*x + 2)*Y[2] - 10000*Y[1]^2
vars =
y
Dy
ode_fun =
function_handle with value:
@(x,Y)[Y(2);Y(1).^2.*-1.0e4+(x.*3.0+2.0).*Y(2).*1.0e4]
Using the vars Information you know that y=Y(1) and Dy=Y(2). Then you can formulate the problem for numeric solving by bvp5c:
odefun = @(x,Y)[Y(2);Y(1).^2.*-1.0e4+(x.*3.0+2.0).*Y(2).*1.0e4];
bcfun = @(ya,yb)[ya(1); yb(1)-1];
x = linspace(0,1,10);
yinit = [0 0];
solinit = bvpinit(x,yinit);
sol = bvp5c(odefun,bcfun,solinit);
% plot function graph of y
subplot(2,1,1)
plot(sol.x,sol.y(1,:),'r','lineWidth',2)
xlim([0.9998 1])
% plot first derivative of y
subplot(2,1,2)
plot(sol.x,sol.y(2,:),'g','lineWidth',2)
xlim([0.9998 1])
Note that the x-values of the plot are not from 0...1, due to the function would look like a step function in x=1 otherwise.
Best regards
Stephan

更多回答(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