Delay block with vectors
9 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
hello all,
I get an error when I use the discrete "Delay" block with input data as a vector.
"In block 'test_delay/Delay', the size of IC is incompatible with the delay length. When IC is not scalar, the last dimension number of IC should equal to the delay length value. However, in this block, the last dimension number of IC is 3, but the delay length value is 100.
Component:Simulink | Category:Model error
Error in port widths or dimensions. Output port 1 of 'test_delay/Mux' is a one dimensional vector with 3 elements."
![error_delay.png](https://www.mathworks.com/matlabcentral/answers/uploaded_files/206252/error_delay.png)
I understand that the delay block support the use of scalars and vectors. Apparently the problem is related to the initial condition but I don't really understand why. Can anyone help ? Attached is my test model.
Thanks & regards
Laurent
1 commentaire
Ibrahim Guenoune
le 12 Mar 2019
Hello Laurent Dalbies,
I'm writing you for asking if you have resolve this problem, if is the case, could you inform how you were doing ?
Thanks
Réponses (1)
Mauro Fusco
le 12 Mar 2019
Modifié(e) : Mauro Fusco
le 12 Mar 2019
Hi,
see the picture below for a solution. The initial condition has to be set consistently with the number of samples of the delay. As you are specifying 5 samples, also the IC has to be consistent with that. Assuming that you want to keep the initial value
for the first 5 samples, I have used vector concatenate to build the matrix of IC. You can change this, by specifying different vectors to concatenate. Also, note that you need to change a parameter in the initial condition block, which was set to 100. "When IC is not scalar, the last dimension number of IC should equal to the delay length value" means that you have to set this parameter to 5.
Attached you also find running simulation file.![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/208147/image.jpeg)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/208147/image.jpeg)
1 commentaire
Ibrahim Guenoune
le 13 Mar 2019
Bingo !!! your proposition Mauro Fusco works perfectely, many thanks.
Just a detail, for the outport, in dimension runbric it should be -1 for inheriting the signal dimensions.
Regards
Voir également
Catégories
En savoir plus sur Sources dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!