MATLAB: About error in stateflow

algebraic loopHDL Coderstateflow

dear,
when i implement stateflow in block to mult or add signals in stateflow, i have this error:
_Cannot solve algebraic loop involving 'SUMOFPRODUCT/Sumofproduct/Product1' because it consists of blocks that cannot be assigned algebraic variables, i.e., blocks with discrete-valued outputs, blocks with non-double or complex outputs, Stateflow blocks, or nonvirtual subsystems
Need for helping!
Best regards!
Pham van Dung

Best Answer

You have an algebraic loop means that in your model you have a feedback through a block which don't contain any delay, it's like you write y(n)=2*y(n)+1, which is not correct, you should write y(n+1)=2*y(n)+1. to correct insert before your feedback a unit delay block