How to solve difference equation in MATLAB
이전 댓글 표시
How to solve the difference equation for
yn+1 =5/2 yn +yn-1 ,y0 =y1 =1 in terms of the roots of its characteristic equation in MATLAB ?
채택된 답변
추가 답변 (2개)
KSSV
2020년 10월 7일
n = 50 ;
y = zeros(1,n) ;
y(1:2) = 1 ;
for i = 2:n-1
y(i+1) =5/2*y(i) +y(i-1) ;
end
댓글 수: 3
Betty Johnson
2020년 10월 7일
No error in the KSSV posted.
n = 50 ;
y = zeros(1,n) ;
y(1:2) = 1 ;
for i = 2:n-1
y(i+1) =5/2*y(i) +y(i-1) ;
end
disp(y(end-4:end))
You cannot, of course, run this out to infinity.
Walter Roberson
2023년 8월 29일
There are no negative coefficients, and no coefficients with absolute value less than one, and the initial values are positive. Each value is at least 5/2 times the previous one, so a lower bound would be (5/2)^(n-1) and therefore the bound to infinity is infinite
mohammed hussain
2023년 8월 29일
0 개 추천
a = [1 -5/2 -1];
b = 0;
ic = [1 1];
n = 50; % 50 terms
y1 = [ic(1) filter(b, a, ones(1, n-1), ic)];
댓글 수: 1
Walter Roberson
2023년 8월 29일
how does this differ from the accepted answer?
카테고리
도움말 센터 및 File Exchange에서 Structural Mechanics에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!