For Loop Increment Array
I am currently in class and trying to do my assignment. For this assignment we have to create a for loop that creates an array of 0 through 20 with the even numbers. I wrote the code according to my lesson but it keeps inserting a 0 between each number in the array. Is there something obvious I am missing?
% for loop example
for i = 0:2:20
A(i+1) = i^2;
B(i+1) = i;
endI am currently in class and trying to do my assignment. For this assignment we have to create a for loop that creates an array of 0 through 20 with the even numbers. I wrote the code according to my lesson but it keeps inserting a 0 between each number in the array. Is there something obvious I am missing?
% for loop example
for i = 0:2:20
A(i+1) = i^2;
B(i+1) = i;
end I am currently in class and trying to do my assignment. For this assignment we have to create a for loop that creates an array of 0 through 20 with the even numbers. I wrote the code according to my lesson but it keeps inserting a 0 between each number in the array. Is there something obvious I am missing?
% for loop example
for i = 0:2:20
A(i+1) = i^2;
B(i+1) = i;
end for loop, array, increment MATLAB Answers — New Questions