MATLAB: Question of for loop

for loop

for i=1:10 power=(i*i) end; this is my programme and ,now i want to calculate all the values of power.

Best Answer

Do you have a question, other than "How do I format my code?" which is answered by this. Might it be "How do I get power to be an array?" If so, just make * a .* and drop the "for" and "end".
k = 1 : 10; % No "for" needed since it's now vectorized.
power = k .* k % or can use power = k .^2