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!