MATLAB Answers


How to solve this error?

Asked by Priya
on 22 Jan 2014
Latest activity Commented on by Priyatham Ganta on 31 Oct 2015

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.


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

No, you can do it in this forum

Can you help me specifically in this.. When i simulate this model, there's always an error

Log in to comment.


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.


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.

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.

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

Log in to comment.

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today