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!