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

Learn moreOpportunities for recent engineering grads.

Apply Today
Asked by Priya on 22 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.

*No products are associated with this question.*

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.

Show 3 older comments

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.

## 2 Comments

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/113342#comment_191595

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

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/113342#comment_191605

No, you can do it in this forum