Matlab学习记录37

书籍:Matlab实用教程

工具:Matlab2021a

电脑信息:Intel® Xeon® CPU E5-2603 v3 @ 1.60GHz

系统类型:64位操作系统,基于X64的处理器 windows10 专业版

第7章 simulink仿真环境

7.7 用MATLAB命令创建和运行simulink模型

7.7.1 用MATLAB命令创建simulink模型

1、simulink模型与文件

cpp 复制代码
>> new_system('Ex0711model')
>> open_system('Ex0711model')
cpp 复制代码
>> new_system('Ex0711model')
>> open_system('Ex0711model')
>> save_system('Ex0711model','Ex0711') 
>> close_system('Ex0711model',1)
警告: There is no system named 'Ex0711model' to close. You can disable this warning by using 0 as the second argument in the close_system command.
 
> 位置:close_system 
>> close_system('Ex0711',1)

关掉模块。

2、添加模块和信号线

cpp 复制代码
>> open_system('Ex0711')
>> add_block('built-in/Step','Ex0711/Step','position',[20,100,40,120])
>> add_block('built-in/Sum','Ex0711/Sum','position',[60,100,80,120])
>> add_block('built-in/Transfer Fcn','Ex0711/Fcn1','position',[120,90,200,130])
There is no block named 'built-in/Transfer Fcn'
cpp 复制代码
>> add_block('built-in/Scope','Ex0711/Scope','position',[240,90,260,120])
>> add_line('Ex0711','Step/1','Sum/1')
>> add_line('Ex0711','Step/1','Sum/2')
>> add_line('Ex0711','Sum/3','Scope/1')
Invalid Simulink object name: Sum/3.

找不到Fcn模块,Sum也链接不到scope

3、设置模型和模块属性

cpp 复制代码
>> h=gcs

h =

    'Ex0711'
cpp 复制代码
>> set_param('Ex0711','StopTime','15')
>> set_param('Ex0711/Step','time','0')
>> set_param('Ex0711/Sum','Inputs','+-')

4、删除模块额信号线

delete_block('Ex0711/Scope')

delete_line()

7.7.2 用MATLAB命令运行simulink模块

cpp 复制代码
>> y=sim('Ex0711',[0,15])
警告: 'Input Port 1' of 'Ex0711/Scope' is not connected. 
警告: 'Output Port 1' of 'Ex0711/Sum' is not connected. 
警告: Source 'Ex0711/Step' specifies that its sample time (-1) is back-inherited. You should explicitly specify the sample time of sources. You can disable this diagnostic by setting the 'Source block specifies -1 sample time' diagnostic to 'none' in the Sample
Time group on the Diagnostics pane of the Configuration Parameters dialog box. 

y = 

  Simulink.SimulationOutput:

                   tout: [52x1 double] 

     SimulationMetadata: [1x1 Simulink.SimulationMetadata] 
           ErrorMessage: [0x0 char] 
相关推荐
筱顾大牛3 分钟前
黑马点评---用户签到、UV统计
android·服务器·uv
耶叶3 分钟前
Android开发实战:通过网络电子书阅读器实践运用fragment知识
android·jvm
早睡早起好好code11 分钟前
InternNav 论文回看
笔记·python·深度学习·学习·算法
00后程序员张12 分钟前
iPhone 无需越狱文件管理 使用Keymob查看导出文件
android·ios·小程序·https·uni-app·iphone·webview
kcuwu.12 分钟前
Python文件操作零基础及进阶
android·服务器·python
Aliex_git13 分钟前
前端监控笔记(一)
前端·笔记·学习
锋风Fengfeng23 分钟前
Windows怎么方便查看AOSP代码
android·windows
2501_9160088923 分钟前
Unity3D iOS 应用防篡改实战 资源校验、 IPA 二进制保护
android·ios·小程序·https·uni-app·iphone·webview
似水明俊德28 分钟前
16-C#.Net-自研ORM框架-学习笔记
windows·笔记·学习·c#·.net