xp(j) = simplify(-sym(pi) + (2*sym(pi)*(j-1))./(2.*N+1));
A = (1+cos(x)).*double([one_col;sumab])'
Are you sure that this is wanted?
[a,b] = ode45(@(a,b) -(1+cos(a))*b+1, [0 30],0);
Your code does not contain meaningful comments. Guessing its intention is not reliable. Therefore it is hard to estimate, if something is wanted or a mistake.