Effacer les filtres
Effacer les filtres

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

1 vue (au cours des 30 derniers jours)
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 commentaires
Mischa Kim
Mischa Kim le 28 Déc 2020
Please attach the Simulink model so we can help diagnose.
Mark Janssen
Mark Janssen le 28 Déc 2020
Modifié(e) : Mark Janssen le 28 Déc 2020
Do you require the matlab script as well? It is part of a bigger script, so I can't easily share it.

Connectez-vous pour commenter.

Réponses (1)

Nitin Kapgate
Nitin Kapgate le 11 Jan 2021
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:

Catégories

En savoir plus sur Simulink Functions dans Help Center et File Exchange

Produits


Version

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by