フィルターのクリア

Embedded Function Error-algebraic loop error message in Simulink

1 回表示 (過去 30 日間)
iman
iman 2012 年 6 月 21 日
Hi,Help please,when i try to run my Simulink model, i obtain this error:
Cannot solve algebraic loop involving 'Nussbaum/Switch' 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

採用された回答

Kaustubha Govind
Kaustubha Govind 2012 年 6 月 21 日
Do you have an output connect as an input (in a loop)? Perhaps you might want to avoid the algebraic loop in the first place so that Simulink doesn't have to solve it. Please see What are algebraic loops in Simulink and how do I solve them? and this blog post: http://blogs.mathworks.com/seth/2008/07/03/how-did-i-get-an-algebraic-loop-error-when-the-diagnostic-was-set-to-warning/
Also, this previously answered question has a lot of good tips: http://www.mathworks.com/matlabcentral/answers/34478-is-this-the-way-to-solve-algebraic-loops
  2 件のコメント
iman
iman 2012 年 6 月 21 日
Dear Kaustubha,
thank you for your help so very much!!!
I solved my problem related to this error,but in this simulink model i use another Embedded MATLAB block and i have a new error as following:
Output argument 'sn1' is not assigned on some execution paths.
Code generation failed Errors occurred during parsing of MATLAB function 'Nussbaum/Nussbaum4'
Errors occurred during parsing of MATLAB function 'Nussbaum/Nussbaum4'
this is my code in embedded:
function sn1 = fcn(xs,sn,SN)
%eml
sn = sign(sn);
if sn == +1
if SN <= xs^1.5, sn1 = 1;
elseif SN > xs^1.5, sn1 = -1; end
elseif sn == -1
if SN < -xs^1.5, sn1 = 1;
elseif SN >= -xs^1.5, sn1 = -1; end
else
sn1=1;
end
Please Help me!!!
Kaustubha Govind
Kaustubha Govind 2012 年 6 月 22 日
Iman: Ideally, you should post this as a new question, but I'll try and answer it anyway. I think you need to "pre-allocate" sn1. Just add something like "sn1=0" before the if block.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSimulink Functions についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by