Borrar filtros
Borrar filtros

Simulating a difference equation with certain initial values

1 visualización (últimos 30 días)
Jimmy
Jimmy el 27 de Oct. de 2015
Editada: Jimmy el 27 de Oct. de 2015
Hi, I'm trying to simulate the following difference equation in Matlab using the lsim function:
y(k) + a*y(k-1) = b*u(k) + c*u(k-1). Where u is the input, y is the ouput, and [a,b,c] are scalar parameters. y(1)=0.5, u(0)=u(1)=1 are the initial values.
However I cant figure out how to implement these initial values. The document on the lsim function says that it only allows initial values when working with state-space models. I wrote it as a transfer function: tf([b c],[1 a],ts,'Variable','q^-1') but then when i simulate it y(1) will just become equal to u(1) probably because y(0) and u(0) haven been set to 0. How would you guys recommend to solve this?
Thanks for your time!
Working with Matlab R2015a

Respuestas (0)

Categorías

Más información sobre Chemistry en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by