simulate this using script file (time evolution)
1 次查看(过去 30 天)
显示 更早的评论
dx(t)= Bu(t)+ c(t)
I want to simulate the next state for every time steps using m-script..
x(t+1)= x(t) + Bu(t)+ c(t)
It is not working the way I want.
0 个评论
回答(1 个)
Div Tiwari
2016-8-9
Could you elaborate on what you meant by it not working the way you want, Jeffrey? This should be quite simple to implement, but we do need to specify an initial value and index the for-loop correctly. For example, for 'N' steps:
x = zeros(1,N);
x(1) = xInitial; % Set initial value
for t = 1:N-1
% Assuming Bu and c are precomputed
x(t+1) = x(t) + Bu(t) + c(t);
end
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Ordinary Differential Equations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!