필터 지우기
필터 지우기

Integrating second order differential equation BVP error

조회 수: 2 (최근 30일)
matlabkid602
matlabkid602 2018년 10월 31일
편집: Stephan 2018년 11월 1일
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