![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/193101/image.jpeg)
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 ?
1 次查看(过去 30 天)
显示 更早的评论
% 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
2 个评论
Dimitris Kalogiros
2018-10-11
Use this button:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/193101/image.jpeg)
...in order to present your code under a "readable" format.
采纳的回答
Torsten
2018-10-11
q3= integral(fun3,a,b,'ArrayValued',true);
instead of
q3= integral(fun2,a,b,'ArrayValued',true);
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!