필터 지우기
필터 지우기

Why is dsolve giving me the wrong answer?

조회 수: 2 (최근 30일)
Crystal Judd Unson
Crystal Judd Unson 2021년 10월 5일
댓글: Star Strider 2021년 10월 31일
Hi, I'm trying to solve a 4th order differential equation using dsolve but I got a wrong answer. This is my script:
syms y(x)
Dy(x)=diff(y);
D4y(x)=diff(y,4);
y4=dsolve('D4y+8*D2y+16*y==0')
When I executed it I got the following,
y4=C1*cos(2*t) - C3*sin(2*t) + C2*t*cos(2*t) - C4*t*sin(2*t)
The answer should be y4=C1*cos(2*t) + C3*sin(2*t) + C2*t*cos(2*t) + C4*t*sin(2*t). What went wrong in my code? Thank you!
  댓글 수: 1
Star Strider
Star Strider 2021년 10월 31일
syms y(x)
syms C1 C2 C3 C4 positive
Dy(x)=diff(y);
D2y = diff(y,2);
D3y = diff(y,3);
D4y(x) = diff(y,4);
ic = [y(0)==C1, Dy(0)==C2, D2y(0)==C3, D3y(0)==C4];
y4 = dsolve(D4y+8*D2y+16*y==0, ic)
y4 = 
.

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

답변 (1개)

Kumar Pallav
Kumar Pallav 2021년 10월 31일
Hi,
As per my understanding, C1, C2,C3,C4 are arbitrary constants(can be positive or negative) and hence, the answer you got and the expected answer is not different.

카테고리

Help CenterFile Exchange에서 Ordinary Differential Equations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by