Hi there, I'm trying to transfer this academic terms learnings on the fourier series to MATLAB, and running into difficulties.
I want to be able to plot a fourier series approximation against the original function but when I try and calculate the fourier series to 5 steps of n in the final line I get a division by zero error.
I can't see where this division by zero occurs, the only division I am using is dividing by the period, T, which is just pi.
I understand this is probably a bad way to do things! And I don't think I understand the symsum enough, but any help gratefully recieved.
a_0 = (2/T)*int(f, t, 0, T)/2
a_n = (2/T)*int(f*cos(((2*pi)/T)*n*t), t, 0, T)
b_n = (2/T)*int(f*sin(((2*pi)/T)*n*t), t, 0, T)
exp = a_0 + symsum(a_n*cos(((2*pi)/T)*n*t) + b_n*sin(((2*pi)/T)*n*t), n, 1, 5)