Error in port widths or dimensions. Invalid dimension has been specified for input port 1

4 visualizaciones (últimos 30 días)
I have an issue with my Simulink model which is:
good.JPG
Upon running, this model works as expected, giving the right outputs.
However upon simplifying to this model I get an error:
good not good.JPG
Error in port widths or dimensions. Input port 1 of 'withobserver/State-Space1' has 2 elements.
This port does not accept the dimensions (or orientation) specified by the input signal.
All matrices were left untouched. Why does this happen? Any suggestions would be appreciated.

Respuestas (1)

Sourabh
Sourabh el 24 de Mzo. de 2025
I understand that you simplified the model by removing extra Simulink Demux blocks and seek a way to solve port width/dimension error.
There could be an issue in two places which could be the reason behind the error. My observations are based on assumptions about the input and output dimensions of the Simulink State-Space blocks. This is because the specific matrices, A, B, C, and D, that define these dimensions are not available.
  1. In the original model, the use of Demux block after the top State-Space block splits the output dimensions of the State-Space block into 2 outputs of dimension size of 1 each. This is then propagated to the Mux before the bottom State-Space block. The Mux then combines both signals to give an output dimension of size 2. However, in the simplified model, dimension of size 2 is being directly passed as second input in the Mux before the bottom State-Space block, while the first input is still of dimension size of 1.
  2. Moreover, the sum block on the right in the simplified model gets one input of dimension size 2 and other input of dimension size 1 which is incompatible.
To debug further, I suggest enabling Signal Dimension under Information Overlays. To do so, in the Simulink Editor, on the Debug tab, click Information Overlays > Signals > Signal Dimensions
To know more on Mux, Demux and State-Space blocks, kindly refer to the following MATLAB documentation:
I hope this is beneficial!

Categorías

Más información sobre Simulink en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by