Simulink: 2001x1 Double input multiplication with clock value, results in 2001x2001 double, while a 2001x1 double is desired. How can I tackle this?

1 回表示 (過去 30 日間)
I am having trouble within the simulink environment all of a sudden.
I have a model in which a 2001x1 double value is multiplied with a clock input (time variable, should be a 2001x1 double as well). But the output of the multiplication is a 2001x2001 double, which indicates that the it has multiplied each of the input values with each of the clock input values, however, I would like to have each run through of the simulation be a single multiplication of the time with the corresponding input value, so it the result becomes a 2001x1 double as well.
The simulink time (tout) also seems to be a 2001x1 double so I dont really understand what is going wrong here. Could someone please explain this?
  2 件のコメント
Mischa Kim
Mischa Kim 2020 年 12 月 28 日
Please attach the Simulink model so we can help diagnose.
Mark Janssen
Mark Janssen 2020 年 12 月 28 日
編集済み: Mark Janssen 2020 年 12 月 28 日
Do you require the matlab script as well? It is part of a bigger script, so I can't easily share it.

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

回答 (1 件)

Nitin Kapgate
Nitin Kapgate 2021 年 1 月 11 日
In your model, the clcok time is getting multiplied with each element of a vector, that's why "Why" and "Why2" are 2001*2001 vectors.
To get the desired 2001*1 output vector, you need to specify the input as a time varying output.
You can refer to the model configuration in the attached simulink model (demoModel.slx) and resolve your issue using a similar approach.
Before running the model, run the following commands in MATLAB command window:
a = 1 + zeros(2001,1); % Time varying input
t = 0:0.005:10' ; % fixed time step of 0.005 sec to get time 2001 points
Use scope to analyze the ouput of the simulation.
The solver settings are as follows (Press CTRL+E to get there):
The Data Import/Export settings are as follows:

カテゴリ

Help Center および File ExchangeSources についてさらに検索

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by