找到你要的答案

Q:Multiplication of two matrices in Simulink

Q:在Simulink两矩阵相乘

I want two find multiplication of two matrices in Simulink. Is it possible to read A and B matrices from Workspace and find multiplication of them in simulink? Which block should I use to read those data? Is From workspace block designed for this?

Thanks in advance

我想要两找到在Simulink的两个矩阵乘法。可以读A和B矩阵的空间并在Simulink中发现乘法呢?我应该用哪个块来读取这些数据?是从工作区块设计的吗?

先谢谢了。

answer1: 回答1:

No, the From Workspace block is designed for importing a signal from the workspace, that is a variable which is time-dependent. You don't say in your question, but it sounds like your matrices are constant parameters, which do not vary with time. Please make sure you understand the fundamental difference between a parameter and a signal, it's a common mistake many people new to Simulink make.

To answer your question, you should use the Constant blocks, parameterised with the matrices' variable names. Then, simply use the Product block, making sure to set the "Multiplication" drop-down parameter to "Matrix" instead of the default "Element-wise".

不,从工作区块的设计是从工作区导入一个信号,这是一个随时间变化的变量。你不说你的问题,但它听起来像你的矩阵是不变的参数,不随时间变化。请确保您了解的参数和信号之间的根本区别,这是一个常见的错误,许多人新的Simulink做。

回答你的问题,你应该使用固定块,参数的矩阵变量名。然后,简单地使用产品块,确保将“乘法”下拉参数设置为“矩阵”,而不是默认的“元素明智”。

matlab  simulink