个人资料
marquis1991
marquis1991
博客十周年地图
  • 博客等级:
  • 博客积分:578积分
  • 博客访问:1,096
  • 关注人气:22
  • 获赠金笔:3
  • 赠出金笔:4
  • 荣誉徽章:点亮荣誉勋章兑换图片博主服务兑换私密博文现有金笔6支
正文 字体大小:

Simulink初步之:积分器与Compare To Zero比较器(Simulation of a Bouncing Ball)

(2013-04-11 10:54:55)
分类: MATLAB之SimuLink初步

案例:在10m处,以15m/s的速度向上抛出一个小球,每落地碰撞一次就会有:v+=-k*v-;

http://s10/mw690/7a4374394da0cf90f5e99&690To Zero比较器(Simulation of Bouncing Ball)" TITLE="Simulink初步之:积分器与Compare To Zero比较器(Simulation of Bouncing Ball)" />

这是一个混合系统:速度和位移是连续的,而在碰撞过程中速度是离散的。

连续:

http://s11/mw690/7a43743907c34816d8caa&690To Zero比较器(Simulation of Bouncing Ball)" TITLE="Simulink初步之:积分器与Compare To Zero比较器(Simulation of Bouncing Ball)" />

离散:

http://s9/mw690/7a4374394da0d11eadf68&690To Zero比较器(Simulation of Bouncing Ball)" TITLE="Simulink初步之:积分器与Compare To Zero比较器(Simulation of Bouncing Ball)" />

很明显,离散发生碰撞的瞬间,而此时如果没有碰撞位移本该变为负,因此我们可以以此作为积分器的复位信号(注:积分器的状态输出端是输出端下一时刻的数值,因此如果我们加一个Compare To Zero比较器做小于或等于比较,让状态输出与零比较,比较器false的时候为0,true的时候为1,就可以得到上升沿),但是积分器的默认状态是很简单的,需要做一下改动。
积分器一开始是这样滴:
http://s4/mw690/7a4374394da0d197a9213&690To Zero比较器(Simulation of Bouncing Ball)" TITLE="Simulink初步之:积分器与Compare To Zero比较器(Simulation of Bouncing Ball)" />

当我们把它的各种属性改变以后:
http://s13/mw690/7a4374394da0d47a7731c&690To Zero比较器(Simulation of Bouncing Ball)" TITLE="Simulink初步之:积分器与Compare To Zero比较器(Simulation of Bouncing Ball)" />
形状变为:

http://s10/mw690/7a4374394da0d4445d249&690To Zero比较器(Simulation of Bouncing Ball)" TITLE="Simulink初步之:积分器与Compare To Zero比较器(Simulation of Bouncing Ball)" />

这是最终图:

http://s2/mw690/7a4374394da0df3b142b1&690To Zero比较器(Simulation of Bouncing Ball)" TITLE="Simulink初步之:积分器与Compare To Zero比较器(Simulation of Bouncing Ball)" />

http://s13/mw690/7a4374394da0e00dc170c&690To Zero比较器(Simulation of Bouncing Ball)" TITLE="Simulink初步之:积分器与Compare To Zero比较器(Simulation of Bouncing Ball)" />



在solver中设置仿真时间为20s,仿真过程中有可能出现错误:Warning: The simulation has ignored searching for zero-crossing events at time19.15980830363748 for (1) zero crossing signals. 

按照提示在command里输入set_param('te','MaxConsecutiveZCsMsg','none');即可。

 

当然,也可以只直接使用二阶积分器:

http://s8/mw690/7a4374394da10f8efdf57&690To Zero比较器(Simulation of Bouncing Ball)" TITLE="Simulink初步之:积分器与Compare To Zero比较器(Simulation of Bouncing Ball)" />

要对积分器的x作限制

http://s1/mw690/7a4374394da110b026320&690To Zero比较器(Simulation of Bouncing Ball)" TITLE="Simulink初步之:积分器与Compare To Zero比较器(Simulation of Bouncing Ball)" />
对于速度

http://s4/mw690/7a4374394da110c8cba23&690To Zero比较器(Simulation of Bouncing Ball)" TITLE="Simulink初步之:积分器与Compare To Zero比较器(Simulation of Bouncing Ball)" />
当x达到0时,重新初始化速度:
http://s7/mw690/7a4374394da110ecd5076&690To Zero比较器(Simulation of Bouncing Ball)" TITLE="Simulink初步之:积分器与Compare To Zero比较器(Simulation of Bouncing Ball)" />

官方的参考图加了个Memory,我试了,不加也行:

http://s1/mw690/7a4374394da1116ae0380&690To Zero比较器(Simulation of Bouncing Ball)" TITLE="Simulink初步之:积分器与Compare To Zero比较器(Simulation of Bouncing Ball)" />










 

阅读(5094) 收藏(0) 喜欢 打印举报/Report
  

新浪BLOG意见反馈留言板 欢迎批评指正

新浪简介 | About Sina | 广告服务 | 联系我们 | 招聘信息 | 网站律师 | SINA English | 产品答疑

新浪公司 版权所有

幻灯播放