Matlab Indexing Error A(I) = B
信息
此问题已关闭。 请重新打开它进行编辑或回答。
显示 更早的评论
Hi. I am new to matlab and have this error I can't quite figure out. Here's the code:
clear all
clc
h = 12.5;
l = 12;
L = 16;
m = pi/10:pi/10:2*pi;
n = length(m);
d_plot = zeros(1,n);
for i = 1:n
d = acos((L*cos(m) - h)/l);
d_plot(i) = d;
end
The error says: In an assignment A(I) = B, the number of elements in B and I must be the same.
Error in ==> test2 at 12 d_plot(i) = d;
Will appreciate it if someone could point out the error for me. Thanks in advance
1 个评论
Walter Roberson
2013-4-4
Each time through the "for i" loop, you are calculating exactly the same thing. Why is that?
回答(0 个)
此问题已关闭。
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!