如何从Workspace在Simulink中输入双精度值? [英] How to input double values in Simulink from Workspace?

查看:406
本文介绍了如何从Workspace在Simulink中输入双精度值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要做一个非常基本的操作,即在Simulink中将两个数字相加.这些值将作为变量存储在工作空间中.

I need to do a very basic operation of adding two numbers in Simulink. The values are stored as variables in the workspace.

从工作区"块似乎采用时间序列或结构作为输入.我不确定如何转换数据以执行此基本操作.

The 'From Workspace' block seems to take either Timeseries or structures as input. I am not sure how to convert the data to do this basic operation.

推荐答案

  • 如果您的数字"是参数-也就是说,它们不会随 时间-使用常量块.
  • 如果它们是变量信号-即它们 取决于时间-然后使用来自工作区块,然后包裹 文档中所述的数据(数组,时间序列, 等等...),以便您获得数据+相应的时间值.
    • If your "numbers" are parameters - that is they do not vary with time - use Constant blocks.
    • If they are variables or signals- i.e. they are time-dependent - then use the From Workspace blocks, and package the data as described in the documentation (array, timeseries, etc...) so that you have the data + the corresponding time values.
    • 您必须记住Simulink是用于建模随时间变化的动态系统的,因此所有内容均假定为时间相关的.话虽如此,您可以使用基本工作区中的数据(读取参数)对Simulink中的任何块进行参数化,Simulink会自动将其拾取.

      You have to remember that Simulink is for modelling dynamic systems that vary with time, so everything is assumed to be time-dependent. Having said that, you can parameterize any block in Simulink using data (read parameters) from the base workspace, it's picked up automatically by Simulink.

      对于不依赖时间(参数)的数据的简单操作,使用MATLAB比使用Simulink更好.

      For simple operations on data that is not time-dependent (parameters), you are better off using MATLAB than Simulink.

      这篇关于如何从Workspace在Simulink中输入双精度值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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