Info

This question is closed. Reopen it to edit or answer.

How do I write a code for a linear system in the form a(n+1) = c*a(n) + b

1 view (last 30 days)
How do I write a matlab code to solve a linear dynamical system of equations in the general form of a(n+1) = c*a(n) + b with an initial value a_0 and the steps range from 1 to N
  3 Comments
Francesca Esquivel
Francesca Esquivel on 29 Jan 2020
Ok, then how would I write a code that would solve the system i have written?

Answers (1)

KSSV
KSSV on 29 Jan 2020
N = 100 ;
a0 = rand ; % initial a
b = rand ; c = rand ;
a = zeros(N,1) ;
a(1) = a0 ;
for n = 2:N
a(n) = c*a(n-1)+b ;
end

Products


Release

R2019b

Community Treasure Hunt

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

Start Hunting!