How to solve difference equation in MATLAB
Mostrar comentarios más antiguos
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 ?
Respuesta aceptada
Más respuestas (2)
KSSV
el 7 de Oct. de 2020
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 comentarios
Betty Johnson
el 7 de Oct. de 2020
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
el 29 de Ag. de 2023
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
el 29 de Ag. de 2023
0 votos
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 comentario
Walter Roberson
el 29 de Ag. de 2023
how does this differ from the accepted answer?
Categorías
Más información sobre Structural Mechanics en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!