Simulating a difference equation with certain initial values

조회 수: 2 (최근 30일)
Jimmy
Jimmy 2015년 10월 27일
편집: Jimmy 2015년 10월 27일
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개)

카테고리

Help CenterFile Exchange에서 Dynamic System Models에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by