ループエラーを解消したい

5 views (last 30 days)
Ryunosuke Oshima
Ryunosuke Oshima on 14 Jul 2021
以下のエラーを解消したいです。
<エラーメッセージ>
'kmracs/adaptive mechanism/Subsystem2/gaussian' またはこれによって参照されるモデルには、出力の計算中に永続変数または状態変数を更新するブロックが含まれていて、1 つの代数ループではサポートされていません。これは、次のブロックをもつ代数ループです。
<全体の構造>
<adaptive mechanism>
左部のpTphiを出力しているのがsubsystem2です。
<adaptive mechanism/subsystem2>
<gaussianの処理>
function y = fcn(phi0T, phi02T, e, F1, sigma2, count)
persistent Phi E t Fnew Phinew2
if isempty(Phi)&&isempty(E)&&isempty(Fnew)&&isempty(Phinew2)
Phix = zeros(count,5);
Phi = complex(Phix);
Ex = zeros(count,1);
E = complex(Ex);
t = 0;
Fnewx = zeros(5,5*count);
Fnew = complex(Fnewx);
Phinew2x = zeros(count,5);
Phinew2 = complex(Phinew2x);
end
if any(e,'all')
t = t + 1;
if t< count+1
Phi(t,:) = phi02T*F1;
E(t,:) = e;
Fnew(:,5*t-4:5*t)=F1;
else
i = 2;
while (i< count+1)
Phi(i-1,:) = Phi(i,:);
E(i-1,:) = E(i,:);
Fnew(:,5*(i-1)-4:5*(i-1))=Fnew(:,5*i-4:5*i);
i = i + 1;
end
Phi(count,:) = phi02T*F1;
E(count,:) = e;
Fnew(:,5*count-4:5*count)=F1;
end
Phinew = phi0T*Fnew;
p=1;
q=1;
j=1;
while (j< 5*count+1)
Phinew2(p,q)=Phinew(1,j);
j=j + 1;
if(q < 5)
q = q + 1;
else
q = 1;
p = p + 1;
end
end
G = Phinew2 - Phi;
B = vecnorm(G,2,2);
C = -B.*B/(2*(sigma2^2));
k = exp(C);
y = k'*E;
else
y = 0;
end
end
<試したこと>
現在plantの中身は次のような離散時変伝達関数(discrete filter)になっています。
これを離散時不変伝達関数(discrete transfer fcn)に置き換えたところ、エラーが発生せずに動作しました。

Answers (0)

Categories

Find more on ループと条件付きステートメント in Help Center and File Exchange

Products


Release

R2021a

Community Treasure Hunt

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

Start Hunting!