model a discrete system without using mdlupdate routine
조회 수: 4 (최근 30일)
이전 댓글 표시
Hello,
Is there a way to write a S-Function describing a discrete system with memory (e.g 1/z), without using the mdlUpdate routine to update the value of the discrete states
thanks in advance
댓글 수: 0
채택된 답변
Kaustubha Govind
2012년 2월 22일
Writing a mdlUpdate is the correct way to do this. Is there a reason you want to avoid that?
You could of course get around this by combining the mdlUpdate code at the end of the mdlOutput function. For example, if u=input, x=state and y=output, your mdlOutput should look like this:
y = x;
x = u;
This is okay as long as your DirectFeedthrough is still set to true (if you set it to false, then it is not allowed to access your inputs from the output function). Setting DirectFeedthrough=true is okay if you don't plan to use your S-function block in a feedback loop that causes algebraic loops.
댓글 수: 2
Kaustubha Govind
2012년 2월 23일
Yes, the DirectFeedthrough flag is set in mdlInitializeSizes. I *think* the default may be true.
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!