Simulink中的累加器 [英] Accumulator in Simulink

查看:1550
本文介绍了Simulink中的累加器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在simulink中有一个MATLAB功能块,对于simlulink的每一步,我都想输入一个增量为1的计数器. 前任: 第一步-> Acc = 1 第二步-> Acc = 2

I have a MATLAB function block in simulink and for each step simlulink does I want to input a counter with increment 1. Ex: 1st Step -> Acc=1 2nd Step -> Acc=2

我尝试使用计数模块+脉冲发生器,但是simulink的时间步长不是恒定的.

I tried using a Count up block + Pulse generator but the time step of simulink is not constant.

有什么想法吗?

推荐答案

为什么不只使用积分器块?您可以根据模型类型选择不连续的或连续的积分器.您可以根据需要指定开始条件/值和重置条件.下图显示了离散块和连续块的示例.两者都只是使用其默认值.要执行您想要的操作(每步输出加1),只需将模型采样时间定义为环境变量(例如sT = 0.01),并将积分器增益设置为1/sT.

Why not just use an integrator block? You can choose with a discreet or continuous integrator block depending on your model type. You can specify the start conditions/value and reset conditions if needed. The image below shows an example of discreet and continuous blocks. Both are just using their default values. To do what you want (adding 1 to the output every step) just define the model sample time as an environment variable (eg sT=0.01) and set the integrator gain to be 1/sT.

这篇关于Simulink中的累加器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆