Why do I receive "Error in port widths or dimensions"?

6 ビュー (過去 30 日間)
禹辰
禹辰 2024 年 8 月 5 日
編集済み: Fangjun Jiang 2024 年 8 月 9 日
I have a system as shown in the picture. y is a scalar defined in the function(also shown in picture).
However I have received such errors. Why is this happening?
Error in port widths or dimensions. Invalid dimension has been specified for 'input port 2' of 'slxlx/Add'.
Error in port widths or dimensions. 'output port 1' of 'slxlx/Transfer Fcn' is a one dimensional vector with 1 elements.
  2 件のコメント
Infinite_king
Infinite_king 2024 年 8 月 5 日
Hi 禹辰,
It looks like the dimensions of some signals are not as expected by the solver. Check the dimensions of various signals in your model and verify that they match your expectations. Focus specifically on the 'Add' block input and the 'Transfer Fcn' output, as the errors suggest issues with these blocks.
For more detailed information on how to view signal dimensions, refer to this MATLAB resource :- Signal Dimensions Display
Sahas
Sahas 2024 年 8 月 7 日
Hi @禹辰,
I understood the issue the model is facing, but I couldn't reproduce it on my side. To further investigate the issue, it would be beneficial if you could provide the model.

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

回答 (1 件)

Fangjun Jiang
Fangjun Jiang 2024 年 8 月 9 日
編集済み: Fangjun Jiang 2024 年 8 月 9 日
Simulink uses forward propagation and back propagation to determine the size of the signal. There is a conflict in this propagation in your model.
The root cause seems to be from the square "Add" block on the left. It seems to be that there is enough info to determine the size of the output of this "Add" block is 4. The size of the first input of this "Add" block is 1. The only chance that this could work is that the second input of this "Add" block is 4. But it is not. It is determined to be size 1.
Check the downstream signal of that square "Add" block. See if there is anywhere that specify that signal to be size 4. It probably should be size 1. Correct that then your model should be working properly.

カテゴリ

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

製品


リリース

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by