在线咨询
eetop公众号 创芯大讲堂 创芯人才网
切换到宽版

EETOP 创芯网论坛 (原名:电子顶级开发网)

手机号码,快捷登录

手机号码,快捷登录

找回密码

  登录   注册  

快捷导航
搜帖子
查看: 13954|回复: 44

横润科技《MATLAB的S-Function编写指导》.pdf

[复制链接]
发表于 2010-4-3 09:31:45 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?注册

x
本帖最后由 eecsseudl 于 2013-4-29 10:13 编辑

i

S-FUNCTION 概述 ....................................................................................................................................1

什么是 S-F UNCTION ................................................................................................................................2
在模型中使用
S-F UNCTION ....................................................................................................................3

S-Function 传递参数 .....................................................................................................................3
何时使用
S-Function ..........................................................................................................................4
S-F
UNCTION
的工作原理 ........................................................................................................................5
Simulink
块的数学关系 ......................................................................................................................5
仿真过程
..............................................................................................................................................5
S-Function
回调程序 ..........................................................................................................................6
S-F
UNCTION
的实现 ................................................................................................................................8

M- 文件的 S-Function .........................................................................................................................8
MEX
文件的 S-function .....................................................................................................................8
MEX
文件与 M- 文件的 S-function 比较 ...........................................................................................9
S-F
UNCTION
的概念 ..............................................................................................................................10
直接馈通
............................................................................................................................................10
动态维矩阵
........................................................................................................................................10
设置采样时间和偏移量
.....................................................................................................................11
S-F
UNCTION
范例 ..................................................................................................................................14

M 文件 S-function 范例 ....................................................................................................................15
C S-Function
范例 ............................................................................................................................16
Fortran S-Function
范例 ..................................................................................................................18
C++ S-Function
范例 .......................................................................................................................18
Ada S-Function
范例 .......................................................................................................................18

编写 M S-FUNCTION ..............................................................................................................................19

概述 ........................................................................................................................................................20

S-Function 参数 ................................................................................................................................20
S-Function
的输出 ............................................................................................................................20
定义
S-F UNCTION 块特性 .....................................................................................................................22
处理
S-F UNCTION 参数 .........................................................................................................................22
M
文件的 S-F UNCTION 范例 .................................................................................................................23

范例 1 ——简单的 M 文件 S-Function ...........................................................................................23
范例
2 ——连续状态 S-Function ....................................................................................................25
范例
3 ——离散状态 S-Function ....................................................................................................27
范例
4 ——混合系统 S-Function ....................................................................................................28
范例
5 ——变步长 S-Function ........................................................................................................31
ii

使用 C 语言编写 S-FUNCTION .............................................................................................................33

概述 ........................................................................................................................................................34

创建 C MEX S-Function ..................................................................................................................35
自动生成
S-F UNCTION ..........................................................................................................................36
配置生成的
S-Function ....................................................................................................................37
S-Function Builder
如何生成 S-Function ......................................................................................37
设置
include 路径 .............................................................................................................................37
S-F
UNCTION B UILDER
的对话窗 ...........................................................................................................39
Initialization
选卡 ..............................................................................................................................39
Data Properties
选卡 .......................................................................................................................40
Libraries
选卡 ....................................................................................................................................42
Outputs
选卡 .....................................................................................................................................43
Continuous Derivatives
选卡 ..........................................................................................................45
Discrete Update
选卡 ......................................................................................................................46
Build Info
选卡 ..................................................................................................................................47
一个基本的
C MEX S-F UNCTION 范例 ...............................................................................................48
定义与包含
........................................................................................................................................49
回调函数的实现
................................................................................................................................50
Simulink/Real-Time Workshop
接口 .............................................................................................51
Building Timestwo
范例 ...................................................................................................................51
C S-F
UNCTION
模板 ..............................................................................................................................52

S-Function 源文件必需的内容 ........................................................................................................52
SimStruct
...........................................................................................................................................53
编译
C S-Function ............................................................................................................................53
S
IMULINK
如何与 C S-F UNCTION 相互作用 ........................................................................................54
进程层面
............................................................................................................................................54
数据层面
............................................................................................................................................56
编写回调函数
........................................................................................................................................59
L EVEL 1 C MEX S-F UNCTION 转换到 L EVEL 2 ..............................................................................60

创建 C++ S-FUNCTION ..........................................................................................................................63

创建 ADA S-FUNCTION .........................................................................................................................64

创建 FORTRAN S-FUNCTION ..............................................................................................................65

实现块特性 ................................................................................................................................................67

对话框参数 ............................................................................................................................................68
iii

可调参数 ............................................................................................................................................68
运行参数
................................................................................................................................................70
创建运行参数
....................................................................................................................................70
更新运行参数
....................................................................................................................................71
创建输入和输出端口
............................................................................................................................72
创建输入端口
....................................................................................................................................72
创建输出端口
....................................................................................................................................73
输入的标量扩展
................................................................................................................................74
掩码多端口
S-Function ....................................................................................................................75
自定义数据类型
....................................................................................................................................76
采样时间
................................................................................................................................................77
基于块的采样时间
............................................................................................................................77
指定基于端口的采样时间
................................................................................................................79
基于块与基于端口的混合采样时间
................................................................................................81
多速率
S-Function .......................................................................................................................82
多速率
S-Function 块的同步 ...........................................................................................................83
工作向量
................................................................................................................................................84

工作向量与过零检测 ........................................................................................................................85
包括指针工作向量的范例
................................................................................................................85
内存分配
............................................................................................................................................86
F
UNCTION -C ALL
子系统 ........................................................................................................................87
错误处理
................................................................................................................................................89
防超程代码
........................................................................................................................................89
SsSetErrorStatus
的终止条件 ........................................................................................................90
数组边界检查
....................................................................................................................................90
S-F
UNCTION
范例 ..................................................................................................................................91
连续状态的
S-Function 范例 ...........................................................................................................92
离散状态的
S-Function 范例 ...........................................................................................................93
混合系统的
S-Function 范例 ...........................................................................................................93
变步长的
S-Function 范例 ...............................................................................................................94
过零检测的
S-Function 范例 ...........................................................................................................94
时变连续传递函数的
S-Function 范例 ...........................................................................................94






横润科技《MATLAB的S-Function编写指导》.pdf

2.97 MB, 下载次数: 647 , 下载积分: 资产 -2 信元, 下载支出 2 信元

发表于 2010-4-3 12:00:49 | 显示全部楼层
谢谢,看来挺有用的
发表于 2010-4-3 12:11:33 | 显示全部楼层
xia look ok
发表于 2010-4-3 15:13:52 | 显示全部楼层
这个东西很管用。很详尽
发表于 2010-4-3 16:29:32 | 显示全部楼层

                               
登录/注册后可看大图
发表于 2010-4-15 20:54:27 | 显示全部楼层
这个东西很管用。很详尽
发表于 2010-4-19 13:04:40 | 显示全部楼层
真的很感谢楼主!这是我在本论坛下载的第一份资料。再次谢谢!
发表于 2010-4-25 17:30:43 | 显示全部楼层
thank u~~~~~~~~~
发表于 2010-4-28 18:49:38 | 显示全部楼层
thanks for sharing
发表于 2010-6-11 15:37:08 | 显示全部楼层
学习一下,谢谢楼主分享
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

站长推荐 上一条 /2 下一条


小黑屋| 手机版| 关于我们| 联系我们| 在线咨询| 隐私声明| EETOP 创芯网
( 京ICP备:10050787号 京公网安备:11010502037710 )

GMT+8, 2024-11-22 21:43 , Processed in 0.025273 second(s), 9 queries , Gzip On, Redis On.

eetop公众号 创芯大讲堂 创芯人才网
快速回复 返回顶部 返回列表