On Tue, Jun 20, 2017 at 2:26 AM, shankara naryana
<address@hidden> wrote:
got rid of i and j my code looks like this:
%Vectorization
clc;
clear;
a=[1 2 3 4 5]; %array created per spec
x=a; %array created per spec
b=[-2 -1 0 1 2]; %array created per spec
y=5-2.*b; %array created per spec
z=(y+x).^3; %formula to be solved in loop
for m=a
t=z
end
Actually you already wrote the vectorized form. There is no need for the for loop anymore
For the for loop solution, you would need to calculate the solution for each index separately.