Afficher commentaires plus anciens
下記のようなコードを作りました。中身は1度でも1の入力がされると、その後は1の入力が続く仕組みとなっています。
これよりも簡便な関数もしくは、simulinkのブロック図がありましたら教えて頂けないでしょうか。
よろしくお願い致します。
clear;
aa = 0 : 0.01 : 10;
u = ones(1,numel(aa));
flg = zeros(1,numel(aa));
for x = 2 : 1 : 10002
u(x) = sin(deg2rad(x / 10));
if flg(x-1) == 1
flg(x) = 1;
else % flg == 0
if u(x) == 1
flg(x) = 1;
end
end
end
hold on
plot(flg);
plot(u);
hold off
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Simulink でサポートされているハードウェア dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
