PDA

View Full Version : for loop problem


williamrand1
Jul27-11, 06:20 AM
Hi all,

Im having a problem with the for loop. Any help would be great!!

The code is simple,

x = -3:0.5:3;

For i = x

q(i) = i^2;

end

q

The error seems to be the negative index in the statement of the for loop.

Hope this is clear. Thanks!!

jtbell
Jul27-11, 08:27 AM
What language is this?

williamrand1
Jul27-11, 09:07 AM
What language is this?

Soory for the delay. The language is matlab.

williamrand1
Jul27-11, 12:55 PM
Ive figured it out lads so thanks anyway....