MATLAB: How to vectorize integral

caputo codeintegrationvectorization

h=0.1;
t1=0:h:2*pi;
alpha=0.3;
f=@(x) sin(x);
for i=2:length(t1)
t=t1(i);
k=1/gamma(1-alpha);
w=@(s) (t-s).^(-alpha).*cos(s);
p(i)=integral(w,0,t);
end

Best Answer

alpha=0.3;
syms s t
w = int((t-s).^(-alpha).*cos(s), s, 0, t);
h=0.1;
t1=0:h:2*pi;
p = double(subs(w, t, t1));