Effacer les filtres
Effacer les filtres

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 vue (au cours des 30 derniers jours)
% 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 commentaires
Dimitris Kalogiros
Dimitris Kalogiros le 11 Oct 2018
Use this button:
...in order to present your code under a "readable" format.
Mohamad
Mohamad le 11 Oct 2018
% 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

Connectez-vous pour commenter.

Réponse acceptée

Torsten
Torsten le 11 Oct 2018
q3= integral(fun3,a,b,'ArrayValued',true);
instead of
q3= integral(fun2,a,b,'ArrayValued',true);

Plus de réponses (0)

Catégories

En savoir plus sur MATLAB dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by