Need help with difference equation

조회 수: 1 (최근 30일)
Alex
Alex 2012년 10월 27일
Hello, Consider the difference equation:
y(n + 2) + y(n + 1) + y(n) = 0, y(1) = y(2) = 1.
Compute y(3), y(4), y(5), y(6), y(7).
I understand how this can be done on paper, but it is not too easy to count. How it can be done in Matlab? My solution:
y(n)=c*z^n
c*z^(n+2)-c*z^(n+1) - c*z^n=0
c*z^n*(z^2-z-1)=0
z1=(1+sqrt(5))/2
z2=(1-sqrt(5))/2
y(n) = c1*((1+sqrt(5))/2)^n + c2 * ((1+sqrt(5))/2)^n
y(1)=c1*((1+sqrt(5))/2) + c1*((1+sqrt(5))/2) =1
y(2)=c1*((1+sqrt(5))/2)^2 + c2 * ((1+sqrt(5))/2)^2=1
Further solving the system can obtain the unknown constants ... but they are too attractive for mental calculations.

채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2012년 10월 27일
편집: Azzi Abdelmalek 2012년 10월 27일
It's easier to solve it in discret time domain
y(1)=1
y(2)=1
for n=3:7
y(n)=-y(n-1)-y(n-2) % equivalent to y(n+2)=-y(n+1)-y(n)
end
  댓글 수: 1
Alex
Alex 2012년 10월 27일
Thank you very much, really easy))

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Signal Processing Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by