I got Error using vertcat Dimensions of arrays being concatenated are not consistent. Error in Code_tubes (line 22) C = [q(1); q(2); q(3);

1 visualización (últimos 30 días)
I try to do compitational kinematic analysis, but when i write the driving constrain, this error occur, i dont have any idea about whats wrong in my line. Please somebody help me
%Input
d = 27.5; %cm
l2 = 31; %cm
l3 = 37; %cm
l4 = 38.5; %cm
w2 = 2; %rad/s
teta2_o = pi/2; %rad
t = 0:0.001:2;
Numdata = size(t,2);
%Matrix coordinate
q = zeros(12,1);
q_all = zeros(12,Numdata);
qdot_all = zeros(12,Numdata);
qdot2_all = zeros(12,Numdata);
uC = zeros(2,1);
rC_all = zeros(2,Numdata);
for j = 1:Numdata
for i = 1:3 %number of iteration
%Constrain matrix
C = [q(1); q(2); q(3);
q(4) - (l2*cos(q(6)))/2;
q(5) - (l2*sin(q(6)))/2;
q(4) + (l2*cos(q(6)))/2 - q(7) + (l3*cos(q(9)))/2;
q(5) + (l2*sin(q(6)))/2 - q(8) + (l3*sin(q(9)))/2;
q(7) - q(10) + (l4*cos(q(12)))/2;
q(8) - q(11) + (l4*sin(q(12)))/2;
q(10) + (l4*cos(q(12)))/2 - d;
q(11) + (l4*sin(q(12)))/2;
q(6) - teta2_o - w2*t];

Respuesta aceptada

Joseph Cheng
Joseph Cheng el 9 de Nov. de 2021
a quick scan shows it at the last row of C with
q(6) - teta2_o - w2*t];
where everything up to that looks to be a 1x1 large as you're indexing through q for 1 index but then you have t which is defined as
t = 0:0.001:2;
so you cant squeeze something that wide into a single index array entry.
Also it doesn't look like you're doing anything using the i and j for the for loop but that is another question
  1 comentario
Fauzanul Ardhi
Fauzanul Ardhi el 9 de Nov. de 2021
thanks a lot, it works, so i supposed to use t(j), intsead of t. tho i still have error in other line, hope i will figure it out somehow

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Simulink en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by