How can I fix error: horzcat dimensions of matrices being concatenated are not consistent?

3 visualizaciones (últimos 30 días)
theta=210
sign=(cosd (theta)/abs (cosd (theta)))
u=.8
R=12
c=5
y=18
Id=(.5*Md*R^2)
Mp=75
Mb=30
alpha=0
u=.8
L=6*R
a=[1 0 1 0 0 0 0 0 0 0 0; 0 1 0 1 0 0 0 0 0 0 0; 0 0 -R*sind(theta) R*cosd(theta) 0 0 0 0 0 0 1; 0 0 0 0 1 0 1 0 0 0 0; 0 0 0 0 0 1 0 1 0 0 0; 0 0 0 0 -R*sind(theta) R*cosd(theta) 0 0 0 0 0; 0 0 -1 0 -1 0 0 0 (4*abs(sign)) 0 0; 0 0 0 -1 0 -1 0 0 (-4*u*sign) 0 0; 0 0 -c (3*R) -c (-3*R) 0 0 (-4*(y-c)) 0 0; 0 0 0 0 0 0 0 0 -sign u*sign 0; 0 0 0 0 0 0 0 0 (-u*sign) 1 0]
Error using horzcat Dimensions of matrices being concatenated are not consistent.
  2 comentarios
Adam
Adam el 13 de Jun. de 2016
Code seems to work fine for me, depending on what Md actually is. Though since that seems not to be related to the matrix being produced at the end I just put a scalar in for that and also tried a vector. Both ran fine.

Iniciar sesión para comentar.

Respuesta aceptada

the cyclist
the cyclist el 13 de Jun. de 2016
I added the definition
Md = 1;
to get your code to run, but then it ran to completion for me. Are you sure you pasted in the line that caused the error?
It's hard for me to diagnose an error that I cannot replicated, but I would suggest checking the sizes of the intermediate variables, to make sure they are what you expect.

Más respuestas (0)

Categorías

Más información sobre Creating and Concatenating Matrices 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