Need help with difference equation
1 view (last 30 days)
Show older comments
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.
0 Comments
Accepted Answer
Azzi Abdelmalek
on 27 Oct 2012
Edited: Azzi Abdelmalek
on 27 Oct 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
More Answers (0)
See Also
Categories
Find more on Signal Processing Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!