Simulating a difference equation with certain initial values
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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
0 commentaires
Réponses (0)
Voir également
Catégories
En savoir plus sur Dynamic System Models dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!