Incorrect Impulse Train Waveform Fourier Representation

2 views (last 30 days)
Obadah M. on 20 Nov 2020
Commented: Obadah M. on 30 Nov 2020
As the title suggests, I'm trying to plot the impulse train waveform using its Fourier series complex coefficients. I'm using the Fourier series and Fourier coefficients equations shown below:
My issue is that when trying to plot the impulse train waveform using it's Fourier coefficient, , where A is the amplitude and is the time period of the signal, I end up with a signal that exhibits the same time period, but with N as my amplitude instead of A. See the screenshot below.
Here's the code I'm using.
%% Definition %%
N = 90000; % number of harmonics
t = -10:0.01:10;
T_0 = 4; % time period
w0 = 2 * pi * (1/T_0); % angular frequency
A = 2; % amplitude
%% Summation %%
f = 0;
for n = -N:1:N
c_n = A/T_0;
f_n = c_n * exp(1i*n*w0*t);
f = f + f_n;
end
%% Plotting %%
stem(t, f); % plot f(t)
% axis equal
grid on
line([0,0], ylim, 'Color', 'k', 'LineWidth', 1); % Draw line for Y axis.
line(xlim, [0,0], 'Color', 'k', 'LineWidth', 1); % Draw line for X axis.
xlabel('time (s)');
ylabel('f(t)');
title('Impulse Train')
Table 4.3 defines the Fourier coefficients for various signals. See signal number (7)

VBBV on 20 Nov 2020
%if true
%%Definition %%
N = 90000; % number of harmonics
t = -10:2:10;
T_0 = 4; % time period
w0 = 2 * pi * (1/T_0); % angular frequency
A = 2; % amplitude
%%Summation %%
c_n = A/T_0;
f_n= c_n * exp(1i*N*w0.*t);
Plotting %%
stem(t, f_n); % plot f(t)
% axis equal
grid on
line([0,0], ylim, 'Color', 'k', 'LineWidth', 1); % Draw line for Y axis.
line(xlim, [0,0], 'Color', 'k', 'LineWidth', 1); % Draw line for X axis.
xlabel('time (s)');
ylabel('f(t)');
title('Impulse Train')
You don't need a for loop on this case. The result produces pulse train with amplitude of 0.5 since amplitude is given by A/T_0 i.e 2/4

Show 1 older comment
VBBV on 20 Nov 2020
If you want amplitude as A then you need to use
%if true
c_n = A;
f_n = c_n*exp(1i*N*w0.*t)
Obadah M. on 20 Nov 2020
The impulses should appear every ... Which is not the case here... What I'm getting instead is an impulse at each and every t value. I don't think that's how it should be.
Obadah M. on 30 Nov 2020
Any further suggestions are much appreciated.