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] 
相关推荐
阿巴斯甜21 小时前
Android 报错:Zip file '/Users/lyy/develop/repoAndroidLapp/l-app-android-ble/app/bu
android
Kapaseker21 小时前
实战 Compose 中的 IntrinsicSize
android·kotlin
xq95271 天前
Andorid Google 登录接入文档
android
黄林晴1 天前
告别 Modifier 地狱,Compose 样式系统要变天了
android·android jetpack
冬奇Lab1 天前
Android触摸事件分发、手势识别与输入优化实战
android·源码阅读
城东米粉儿2 天前
Android MediaPlayer 笔记
android
Jony_2 天前
Android 启动优化方案
android
阿巴斯甜2 天前
Android studio 报错:Cause: error=86, Bad CPU type in executable
android
张小潇2 天前
AOSP15 Input专题InputReader源码分析
android
_小马快跑_2 天前
Kotlin | 协程调度器选择:何时用CoroutineScope配置,何时用launch指定?
android