how to numerical solve d2y/dx2+f(x)dy/dx+y=0 in matlab. if f(x)=x^2+2x+1

답변 (1개)

Triveni
Triveni 2016년 1월 2일
편집: Triveni 2016년 1월 2일
syms x y;
f=x^2+2*x+1;
df= diff(f);
d2f = diff(df);
solution = d2f + f *(df) + y;
i don't know whya re are you using isequalto 0 in "d2y/dx2+f(x)dy/dx+y=0"
or
syms x y;
f=x^2+2*x+1;
dy = diff(y);
d2y = diff(dy);
solution = d2y + f* dy + y;

댓글 수: 3

Not syms y, rather syms y(x)
The "= 0" is important as it imposes a Differential Equation (ODE in this case) upon it all: the problem becomes to find y(x) such that the equation holds.
There is a symbolic solution that dsolve() might be able to find, a solution that involves a number of invocations of HeunT, and some of those are inside integrals that have no closed form solution. Finding a numeric solution rather than a symbolic solution is therefore appropriate.
Well the symbolic solution is
HeunT(3^(2/3), -3, 0, (1/3)*3^(2/3)*(x+1)) * (exp(-26/3) * HeunT(3^(2/3), -3, 0, 3^(2/3)) * (int(exp((1/3)* z1 * (z1^2 + 3*z1+3)) / HeunT(3^(2/3), -3, 0, (1/3)*3^(2/3) * (z1+1))^2, z1, 0, 2)) - (int(exp((1/3) * z1*(z1^2+3*z1+3)) / HeunT(3^(2/3), -3, 0, (1/3)*3^(2/3)*(z1+1))^2, z1, 0, x)) * (exp(-26/3) * HeunT(3^(2/3), -3, 0, 3^(2/3)) - 10 * HeunT(3^(2/3), -3, 0, (1/3)*3^(2/3)))) * exp(-(1/3) *x * (x^2 + 3*x + 3)) / (exp(-26/3) * HeunT(3^(2/3), -3, 0, 3^(2/3)) * (int(exp((1/3)*z1 * (z1^2 + 3*z1+3)) / HeunT(3^(2/3), -3, 0, (1/3)*3^(2/3) * (z1+1))^2, z1, 0, 2)) * HeunT(3^(2/3), -3, 0, (1/3)*3^(2/3)))
where z1 is a temporary variable of integration.
Notice the three unresolved integrals for which there is no known closed form solution. The symbolic solution might tell you what you need to calculate but it is not a numeric solution at all, and the original poster specifically asked for a numeric solution.

댓글을 달려면 로그인하십시오.

태그

질문:

2015년 12월 31일

댓글:

2016년 1월 3일

Community Treasure Hunt

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

Start Hunting!

Translated by