Hi,
You can create a 'fourier series' with the coefficients a0, AN and BN arrays and use fplot to plot this symbolic function.
For example, the last part of your code can be modified as follows
AN = [];
BN = [];
fourier_series = 0;
for i = 1:max
AN = [AN subs(an,n,i)];
BN = [BN subs(bn,n,i)];
fourier_series = fourier_series + (AN(i) * cos(i*t) + BN(i) * sin(i*t));
end
fplot(t, (a0/2 + fourier_series), [-3,3])
Hope this helps