Error regarding Input port when using SIMULINK
Ältere Kommentare anzeigen
I have system which shows error in this way.
Error in port widths or dimensions. Output port 1 of 'SMC1/LQR_Controller/u' is a one dimensional vector with 3 elements.
Error in port widths or dimensions. Input port 1 of 'SMC1/LQR_Controller/MatrixB' is a one dimensional vector with 1 elements.
Although the MatrixB is receiving the same input as u 's output. Kindly guide me how do I resolve this error.
The image of system is given below:

Antworten (1)
Shlok
am 30 Nov. 2024
0 Stimmen
Hi Sameema,
The above-mentioned error indicates a mismatch in the dimensions of the signal going into and out of the blocks in your Simulink model. In the following figure, it appears that Output port of 'u' produces a 3-element vector, whereas Input port of 'MatrixB' expects a 1-element vector (or scalar).
You can follow one of the following approaches to resolve the issue:
- Check whether the “MatrixB” block is configured correctly by validating its expected input dimensions with the output of “u.” Refer to the following documentation to know more about debugging signal dimensions: https://www.mathworks.com/help/simulink/ug/determining-output-signal-dimensions.html
- If the input to “u” is configurable, you can adjust the output to match the dimensions expected by “MatrixB”. This might involve changing the parameterization or gain settings at the upstream block feeding “u”.
- If “MatrixB” needs only one element from the 3-element vector, use a “Selector” block to extract the specific element required.
Kategorien
Mehr zu Signal Attributes and Indexing finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!