How to step through a discrete model simulation one step at a time
2 ビュー (過去 30 日間)
古いコメントを表示
I have a discrete-time ARX model that I want to use to represent the plant in a simulation:
Ts = 1;
sigma = 0.01;
d = 3;
sys = idpoly([1 -2.4 1.9 -0.5],[0.01 0.001 -0.007],[],[],[],sigma^2,Ts,'IOdelay',d);
How do I simulate this system one timestep at a time in a for loop with my control algorithm?
N = 10;
u = zeros(N,1);
y = zeros(N,1);
for k=1:N
u[k] = rand()*2 - 1;
y[k] = sys ...?
end
(I know how to simulate a whole trajectory):
u = rand(N,1)*2 -1;
y = sim(sys,u);
0 件のコメント
採用された回答
Navya Seelam
2020 年 4 月 3 日
sim function doesn't support onetime step simulation as of now. I have brought this issue to the concerned people and it might be considered in any future release.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Linear Model Identification についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!