Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

Why am I getting 2 solutions for this ODE with one set of initial values?

조회 수: 1 (최근 30일)
Zachary Duff
Zachary Duff 2016년 4월 30일
마감: MATLAB Answer Bot 2021년 8월 20일
Note: I am a beginner in math and in Matlab, any additional wisdom is gratefully received.
So, I'm getting two solutions for this singular ODE, Wolfram A gets one. My y vector in
[t,y] = ode15s(...)
is giving me a size(t) by 2 matrix. And resulting in a plot that looks like:
Here's the equation: xy''+ y' + xy = x . My code attempt to solve it:
tspan = [1e-4 50];
[x,y] = ode15s('p2ODE',tspan,[0 1]);
plot(x,y);
function:
function dxdt = p2ODE( t , x )
y = x(1);
yPrime = x(2);
dy = yPrime;
dyPrime = (-1/t)*yPrime - y + 1;
dxdt = zeros(2,1);
dxdt(1) = dy;
dxdt(2) = dyPrime;
end
But here's Wolfram A solution samples:

답변 (2개)

Jan
Jan 2016년 5월 2일
What is your problem? The integrator replies the position and the velocity as expected. These are not two solutions.
  댓글 수: 1
Zachary Duff
Zachary Duff 2016년 5월 2일
Realized that after just thinking about the code for a few minutes. Computation with vectors and matrices is still new to me. But to answer your question, my problem is exactly as stated.

Torsten
Torsten 2016년 5월 3일

이 질문은 마감되었습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by