Azzera filtri
Azzera filtri

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

2 visualizzazioni (ultimi 30 giorni)
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 Commenti
Adam
Adam il 13 Giu 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.

Accedi per commentare.

Risposta accettata

the cyclist
the cyclist il 13 Giu 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.

Più risposte (0)

Categorie

Scopri di più su Creating and Concatenating Matrices in Help Center e File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by