1.建立子系统
1.1框选需要的模块,右键选择创建子系统
1.2从库中选择子系统模块,双击打开子系统,在其中搭建子系统
2.封装子系统
选中子系统,右键选择Mask中的Edit Mask进入编辑页面。
2.1设置子系统端口名称和颜色
color('red'); %颜色(第一个输入端口)
port_label('input',1,'Control Signal'); %输入,第一个端口,端口名称
color('green'); %颜色(第一个输出端口)
port_label('output',1,'Torque');
color('orange');
port_label('output',2,'Angle');
color('yellow');
port_label('output',3,'speed');
2.2添加模块封面
必须要和simulink仿真在同一个文件夹内,添加在如上图所示处。
image(imread('motor.jpg')); %motor.jpg为图片名称
2.3新增参数设置框
在第二个编辑界面,单击Edit就可以添加新的参数。