LSIM initial condition code

15 ビュー (過去 30 日間)
Kaan Ibis
Kaan Ibis 2018 年 3 月 5 日
回答済み: Ayush Aniket 2024 年 12 月 24 日
Let x(0) = 0 and u(t) = 2, for t >= 0. Obtain a plot of y(t) for 0 <= t <= 20 using the lsim command.
My sys function is ready but I cannot set the initial values in the question above. How can I do this?
lsim(sys1,u,t) This is my code.

回答 (1 件)

Ayush Aniket
Ayush Aniket 2024 年 12 月 24 日
Staring from MATLAB R2024b, one of the ways you can specify the initial conditions for simulating a state-space model in the lsim function by a vector xinit having one entry for each state in sys as shown below:
% Initial condition
xinit = 0; % Initial state, x(0) = 0
% Simulate the system response
[y, tOut, x] = lsim(sys1, u, t, xinit);
Refer to the following documentation links to read an example illustrating the same and the details about the initial condition input argument:

カテゴリ

Help Center および File ExchangeTime and Frequency Domain Analysis についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by