Simink 条件分岐のモデルについて
57 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
入力値CNLTの大きさに応じて1または0を返す出力A,BのモデルをSwitchと論理演算で構成したいと思っています。
イメージしている振る舞いを以下に示します。
CNLT > 30 : A = 0,B = 0
CNLT > 15 && CNLT <= 30 : A = 0,B = 1
CNLT <= 15 : A = 1,B = 1
(変数略)
if (CNLT > 30){
A = 0;
B = 0;
}else if(CNLT > 15){
A = 0;
B = 1;
}else{
A = 1;
B = 1;
}
お手数おかけしますがご教授いただきたいです。
1 commentaire
Réponse acceptée
Atsushi Ueno
le 20 Jan 2024
Modifié(e) : Atsushi Ueno
le 20 Jan 2024
- Relational Operator ブロックと Switch ブロックを組み合わせるパターン ← イマココ
- If ブロックと Action Subsystem ブロックを組み合わせるパターン
単純な信号の取扱いなら前者を使い、複雑なロジックの可読性を良くする為には後者を使うのが良いと思います。
![Simulinkモデルのキャプチャ](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1595406/Simulink%E3%83%A2%E3%83%87%E3%83%AB%E3%81%AE%E3%82%AD%E3%83%A3%E3%83%97%E3%83%81%E3%83%A3.jpeg)
![シミュレーションデータインスペクター画面](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1595411/%E3%82%B7%E3%83%9F%E3%83%A5%E3%83%AC%E3%83%BC%E3%82%B7%E3%83%A7%E3%83%B3%E3%83%87%E3%83%BC%E3%82%BF%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%9A%E3%82%AF%E3%82%BF%E3%83%BC%E7%94%BB%E9%9D%A2.jpeg)
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Simulink Function dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!