필터 지우기
필터 지우기

Finding Intersection Points between 3rd Order ODE and a line

조회 수: 1 (최근 30일)
Izu
Izu 2011년 2월 7일
How can I find the intersection points between the solution of a 3rd order ODE and a line y=x?
My ODE's code is
sol=dsolve('D3y-4*D2y+Dy+2*y=0,y(0)=-4,Dy(0)=-6,D2y(0)=-4')
x=0:2
y=subs(sol,'t',x)
plot(x,y)

채택된 답변

Andrew Newell
Andrew Newell 2011년 2월 7일
The solution of this equation is a symbolic function sol(t):
sol=dsolve('D3y-4*D2y+Dy+2*y=0,y(0)=-4,Dy(0)=-6,D2y(0)=-4');
sol(t)=t is the same as sol(t)-t = 0:
syms t
functionToBeZeroed = sol - t;
Turn this into a numerical function f(x):
f = matlabFunction(functionToBeZeroed);
You can calculate f(x) for any value of x. A plot shows that the curve crosses zero near about x=1.6.
x = 0:.01:2;
plot(x,f(x))
So use fzero to find the solution of sol(x)=x with an initial guess of x=1.6:
fzero(f,1.6)
EDIT: This answer has been revised to expand the explanatory text.
  댓글 수: 2
Izu
Izu 2011년 2월 8일
Uh... sorry... I don't get it... Let's try for a simple function: t = 0:.3:10;
y = sin(t); How will we find the intersections with y=x?
Andrew Newell
Andrew Newell 2011년 2월 8일
I have added some more explanation above. Please note that your simple function is actually sin; the argument t is just the name you choose for the input and the specific values t=0:.3:10 are just a set of numbers you could calculate the sine of. It would be the same to calculate y=sin(x) for x=0:.3:10. To solve sin(x)=x, define f(x) = sin(x)-x and find the zero.
If, on the other hand, you are really trying to solve sin(t)=x, the question is meaningless.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Linear Algebra에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by