Array not in the same size
조회 수: 2 (최근 30일)
이전 댓글 표시
I want to plot a graph of angular velocity vs time. But the error of "Array not in the same size" appear. I already check which array not in the same same size and its show the time were in the same array. Could you help me and give me the suggestion what i can do.
s3 =sind([-45.547825 -45.512272 -45.486092... ])
c2=cosd([56.192139 56.22419 56.258484...])
c3=cosd([-45.547825 -45.512272 -45.486092...])
diff_q1t=[-0.153070611 -0.139225787 -0.124578984 ...]
diff_q2t=[ 0.053429764 0.057896935 0.061122303...]
%All s3,c2,c3, diff_q1t and diff_q2t have 198 data
disp(numel(time)); % Display the number of elements in the time array
disp(numel(s2)); % Display the number of elements in the s2 array
disp(numel(s3)); % Display the number of elements in the s3 array
disp(numel(c2)); % Display the number of elements in the c2 array
disp(numel(c3)); % Display the number of elements in the c3 array
disp(numel(diff_q1t)); % Display the number of elements in the diff_q1t array
disp(numel(diff_q2t)); % Display the number of elements in the diff_q2t array
NwA_a1=(s3.*diff_q2t + c2.*c3.*diff_q1t) %Angular velocity
figure
time = [-0.4,-0.3,-0.2,-0.1,0,0.1];
y = NwA_a1;
plot(time,y)
댓글 수: 0
답변 (1개)
Walter Roberson
2023년 7월 30일
You say that your c2, c3, diff_q1t, diff_q2t and s3 all have 198 data, so
NwA_a1=(s3.*diff_q2t + c2.*c3.*diff_q1t) %Angular velocity
would have 198 data.
time = [-0.4,-0.3,-0.2,-0.1,0,0.1];
That has 6 data
plot(time,y)
You are asking to plot 6 against 198.
The only way it could work is if y is 6 x 33 or 33 x 6.
댓글 수: 2
참고 항목
카테고리
Help Center 및 File Exchange에서 Function Creation에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!