S-function conditions
古いコメントを表示
Hi everyone!
I am new in s-function implementation in Simulink.
from:
dx/dt = Ax + Bu; Y = Cx + Du;
Where you can initialize A, B, C, and D to some value. For next sample time, I would like to change the values of A, B, C, and D. Is there any way to implement the code of it using level 1 s-function?
Sample:
if t >= 1e-5 && u(5)>0
A = [1 2 3 4;4 5 3 1;4 5 3 2;3 4 1 0]; B = [3; 4; 5; 6]; C = [1 2 3 4;4 5 6 1;4 6 3 2;3 6 1 3]; D = [0;0;1;0];
else
A = eye(4); B = zero(4,1); C = eye(4); D = zero(4,1);
end
where should I Implement this type of code?
Also, how can I declare a global variable so that it can be updated at any value of flag.
Thanks!
採用された回答
その他の回答 (1 件)
haMed
2014 年 10 月 10 日
0 投票
I prefer to use stateflow in this issue.
カテゴリ
ヘルプ センター および File Exchange で Create MATLAB S-Functions についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!