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!