# MATLAB: Anonymous function from for loop

anonymous functionfor loopfunction

Hello, I am having trouble creating an anonymous function matrix using a for loop. My code looks like this:
 n=4; %Or w/e number. Could be 100. for i = 1:n    f{i,1} = @(x) (x.^i).*(1-x) end
The output is this:
f =
    @(x)(x.^i).*(1-x)    @(x)(x.^i).*(1-x)    @(x)(x.^i).*(1-x)    @(x)(x.^i).*(1-x)
The problem is that the "i" is not changing. It should look like this:
f =
    @(x)(x.^1).*(1-x)    @(x)(x.^2).*(1-x)    @(x)(x.^3).*(1-x)    @(x)(x.^4).*(1-x)
Any ideas? Also, I will later have to take the derivative of each row. Is there a simple way to do it? Like this maybe:
 derivative(1) = der(f{1}) derivative(2) = der(f{2})
for ii = 1:n  feval(f{ii},pi)end
ans = -6.7280ans =-21.1367ans =-66.4028ans =-208.6106
fns = functions(f{1})fns.workspace{1}
syms x ixf = (x.^i).*(1-x)    f =       -x^4*(x - 1)diff(f,x)    ans =       - 4*x^3*(x - 1) - x^4