I have the following Matlab code:
k=1:1:10;
a=[3,5,2];
for j=1:length(k)
for h =1:1:length(a)
x=a(h);
y1(h)=x^j-2;
end
minfind(j)=min(y1);
end
plot(k, minfind)
I would like to write the same code using Mathematica. So far, I write the following:
a = ( {
{3, 5, 2}
} );
For[j = 1, j <= 10, j = j + 1,
For[h = 1, h <= 3, h = h + 1,
x = Part[a, h];
ytest = x^j - 2;
y1 = Append[y1, ytest];
]
ymin = Min[y1];
minfind = Append[minfind, ymin];
]
But it is not work.
Can anyone help me in this?