Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

How to solve this error?

Asked by Priya on 22 Jan 2014
Latest activity Commented on by Anuj on 23 Jan 2014

I keep getting this error while running the state space model,

Error in port widths or dimensions. Output port 1 of 'statespacemodel_hvm/Mux' is a one dimensional vector with 2 elements.

Error in port widths or dimensions. Input port 1 of 'statespacemodel_hvm/State-Space' has 3 elements. This port does not accept the dimensions (or orientation) specified by the input signal.

Please help me with this.


Azzi Abdelmalek on 22 Jan 2014

Priya, you've just showed the error message, How are we supposed to know what is in your model?

Azzi Abdelmalek on 22 Jan 2014

No, you can do it in this forum




No products are associated with this question.

1 Answer

Answer by Anuj on 22 Jan 2014
Accepted answer

You are getting this error because your matrix dimensions are conflicting. Make sure that the dimensions of matrices in inputs and outputs must agree.


Anuj on 23 Jan 2014

You need to define your B matrix according to system input, If you define it as B=zeros(size(A,1),2), all elements of B will be zero. I hope this helps.

Priya on 23 Jan 2014

Ok. If I need the B matrix to be defined as the difference of the input and the wheelset's position (in my case it is the track input fed to the lateral position of the wheelset),do I have to design it in the model or give it in the mfile(ie., in the B matrix).

Since the state space model in Simulink consists of a track input(as step signal) given to the state space block with a mux.

Anuj on 23 Jan 2014

You can define it as you want, it depends on how you want to simulate it and how you find to do it easy.


Contact us