MATLAB: Hi , I have a problem with phase plot for Fourier series coefficients for periodic function exp(-t/2) , why phase plot is not odd function

fourier series coefficients - phase plot

% FS for exp(-t/2) periodic signal
% Compelx exponential FS
clc
clear;
a=0
b=pi
T0=b-a
N=11
F0=1/T0
wi=[-N:N]*2*pi/T0;
t=(a:0.2:b)';
D=zeros(2*N+1,1);
xt=exp(-0.5*t);
fun1 = @(t)exp(-0.5*t);
q1 = integral(fun1, a,b);
D(N+1)=q1/T0;
for n=1:N;
fun2 = @(t)exp(-0.5*t).*(exp(-j*2*pi*n*F0*t));
q2= integral(fun2,a,b,'ArrayValued',true);
D(N+1+n)=q2/T0;
fun3 = @(t)exp(-0.5*t).*(exp(j*2*pi*n*F0*t));
q3= integral(fun2,a,b,'ArrayValued',true);
D(N+1-n)=q3/T0;
end
% I Repeat the triangle pulse and plot for 7 periods
M=3; % The number of periods needed
tp=[];
xtp=[];
for i=-M:M
tp=[tp i*T0+t];
xtp=[xtp xt];
end
subplot(311)
plot(tp,xtp)
set(gca,'XMinorTick','on','YMinorTick','on')
ylabel('Peiodic decayed exponential function')
grid on
grid minor
subplot(312)
stem(-N:N,abs(D))
set(gca,'XMinorTick','on','YMinorTick','on')
ylabel('abs D_n')
grid on
grid minor
subplot(313)
stem(-N:N,angle(D))
set(gca,'XMinorTick','on','YMinorTick','on')
ylabel('Angle D_n')
grid on
grid minor

Best Answer

q3= integral(fun3,a,b,'ArrayValued',true);
instead of
q3= integral(fun2,a,b,'ArrayValued',true);