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 (최근 30일)
이전 댓글 표시
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
채택된 답변
Joseph Cheng
2021년 11월 9일
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
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!