Hi all. Embarassed to be asking for homework help, but I can't figure out this for loop.
Essentially, I need each iteration of the inner function to save to the matrix T. The size of the matrix remains correct (61×21), but it only saves the last iteration to the matrix. I have tried the i = i+1 indexing method but my matrix blows up to 1281×21 with each column running thru both the inner and outer loops.
clear;x = -3:0.1:3;y = -1:0.1:1;i = length(x);j = length(y);T = zeros(i,j);for x = -3:0.1:3 for y = -1:0.1:1 T(i,j) = x^2+(2*y^2); endend
Best Answer