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 Center および File ExchangeSignal Processing Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by