如果和多个声明

问题描述 投票:0回答:1

我是Simulink的新手。

我想实现以下目标:

if(U1 > U2)
{
   E = U1 + U2
   D = U1 * A
}
else if(U1 < U2)
{
   E = U1 - U2
   D = U1 * B
}
else
{
   E = U1
   D = U2 * U2
}

能否帮助我如何在Simulink中代表上述内容

simulink
1个回答
0
投票

有多种方法可以实现这一点。

一种是使用If子系统。在下面的图像的左侧是高级别的实现。右边是IfElseIfElse子系统的内容。您可能还想查看Merge块的doc,看看它如何选择传递哪个信号作为DE的最终值。

If Action model

另一个是使用MATLAB Function块,

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.