Borrar filtros
Borrar filtros

how to plot the exponential fourier series in matlab?

16 visualizaciones (últimos 30 días)
Daniel Niu
Daniel Niu el 19 de Oct. de 2022
Comentada: VBBV el 19 de Oct. de 2022
I expand a periodic function exp(-t) with T=3.
then sum the series to compare with the original function. However, I think the oscillation
is too large. Where is the problem?
Your help would be highly appreciated.
Best regards.
% (a)plot x(t) over a time interval (0,3)
clear;clc
t = 0:0.01:3; % total simulation time
x = exp(-t);
plot(t,x,'r','LineWidth',2)
a=zeros(1,61);
for K=-30:30
G=@(t)exp(-(t)).*exp(-1i*K*2*pi/3.*t);
a(K+31)=1/3*quad(G,0,3);
end
x30 = 0.*t;
for j = 1:30
x30 = x30 + 2*real(a(j+31)*exp(1i*(j)*pi.*t/1.5));
end
x30=x30++a(31);
hold on
plot(t, x30,'b','LineWidth',2)
% plot(t,x1,'b','LineWidth',2)
% plot(t,abs(x2),'b','LineWidth',3)
%K=-30:30
%stem(K,abs(a));

Respuesta aceptada

VBBV
VBBV el 19 de Oct. de 2022
% (a)plot x(t) over a time interval (0,3)
clear;clc
t = 0:0.01:3; % total simulation time
x = exp(-t);
plot(t,x,'r','LineWidth',2)
a=zeros(1,61);
for K=-30:30
G=@(t)exp(-(t)).*exp(-1i*K*2*pi/3.*t);
a(K+31)=1/3*integral(G,0,3);
end
x30 = 0.*t;
for j = 1:30
x30 = x30 + 2*real(a(j+31)*exp(1i*(j)*pi.*t/1.5));
end
x30=x30++a(31);
hold on
plot(t, x30,'b','LineWidth',2)
  3 comentarios
Daniel Niu
Daniel Niu el 19 de Oct. de 2022
Thank you so much for your explanation! Thank you!
VBBV
VBBV el 19 de Oct. de 2022
Please accept the answer if it solved your problem

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Simulation and Analysis en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by