フィルターのクリア

Info

この質問は閉じられています。 編集または回答するには再度開いてください。

could s-function based on discrete state behave the same as the model constructed by blocks in simulink ?

1 回表示 (過去 30 日間)
WANG Bo
WANG Bo 2012 年 7 月 11 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
I need to use s-function to simulate electric motor, which is defined by four ordinary differential equations (ODEs). I have tried s-function based on continuous state, and it can solve ODEs at a acceptable accuracy compared to the model constructed by blocks in simulink. Now I need to use discrete solver to improve the simulation speed, so I must change the continuous state to discrete state. But I find that the output of the s-function has always one sample time delay compared to the model constructed by blocks. This because in every simulation loop the s-function always compute the output at first and update the discrete state at second, so the output is actually the last sample time's state, not the current. How can I make it act exactly the same as the model? Bow~~ and thanks a lot.
  1 件のコメント
Ryan G
Ryan G 2012 年 7 月 11 日
Are the initial conditions in both the s-function and the block the same?

回答 (0 件)

この質問は閉じられています。

製品

Community Treasure Hunt

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

Start Hunting!

Translated by