Hi,
I encountered a problem while executing a file written to calculate the fourier-coefficients of a function:
In version 2019b, it works totally fine, but in 2020a the code does not behave like I planned.
First of all, the code:
syms x k;
pi= sym(pi);
assume(k,'integer');
f = (x/pi)^3-x/pi;
u = -pi;
o = pi;
p = abs(o - u);
p=sym(p);
u = sym(u);
o = sym(o);
c = simplify(int(f.*exp(-1i*k*x*2*pi/p),x,u,o)/(p));
a = simplify(2*int(f.*cos(k*2*pi/p*x),x,u,o)/(p));
b = simplify(2*int(f.*sin(k*2*pi/p*x),x,u,o)/(p));
pretty(simplify(c))
pretty(simplify(a))
pretty(simplify(b))
In 2019b, the code returns the coefficients as a multiple of pi. In 2020a, MATLAB processes pi and returns the numerical result (for instance 0.3870 instead of 12/(pi^3)).
What do I have to change to get the result as a multiple of pi in version 2020a?
Thanks for your help!