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 view (last 30 days)
Show older comments
Fauzanul Ardhi
on 9 Nov 2021
Commented: Fauzanul Ardhi
on 9 Nov 2021
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];
0 Comments
Accepted Answer
Joseph Cheng
on 9 Nov 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
More Answers (0)
See Also
Categories
Find more on Creating and Concatenating Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!