# How do I implement (in simulink) a matrix dependent on a time-dependent variable?

3 ビュー (過去 30 日間)
Stephen 2013 年 4 月 23 日
I'm not quite sure how to ask this question, but here is a case boiled down to the simplest features (this is part of a much more complex system)
Suppose I have scalar variable M(k) in Simulink that switches discretely from 0 to 1 every 10 seconds.
Now suppose I have a matrix M(k) that is a function of K, that is
[ 1 k; k 8 ]
(this is totally arbitrary for the sake of example) and I want to multiply it by a vector X.
x --->[ M(k) ]---> M(k)*x
Naturally, I would like to place "M" in a "gain" block and set it to Matrix-vector multplication. Is it possible to update "M" if we specify the variable "k" inside of the "gain" block?
I can implement matrix multiplication as multiplying and adding up a bunch of stuff together, but as this is an O(n^3) problem...
I would prefer to do it in one shot. Is it possible?
Edit: I've seen this http://www.mathworks.com/support/solutions/en/data/1-D9A379/, and it is obviously possible, but I am wondering if there is a built in feature that makes this intuitive and easy. All I need to do is Simu-link a time varying variable to a matrix.

サインインしてコメントする。

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!