clear all f = @(x,n) x.^n; n = 1; quad(@(x) f(x,n),0,1) n = 2; quad(@(x) f(x,n),0,1)