Matlab Indexing Error A(I) = B
Infos
Cette question est clôturée. Rouvrir pour modifier ou répondre.
Afficher commentaires plus anciens
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 commentaire
Walter Roberson
le 4 Avr 2013
Each time through the "for i" loop, you are calculating exactly the same thing. Why is that?
Réponses (0)
Cette question est clôturée.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!