Need help with difference equation

1 visualización (últimos 30 días)
Alex
Alex el 27 de Oct. de 2012
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.

Respuesta aceptada

Azzi Abdelmalek
Azzi Abdelmalek el 27 de Oct. de 2012
Editada: Azzi Abdelmalek el 27 de Oct. de 2012
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 comentario
Alex
Alex el 27 de Oct. de 2012
Thank you very much, really easy))

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Signal Processing Toolbox en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by