It produce the spectrum of a signal, that can be treated as part of an infinite periodic signal,
i.e. the sum of several harmonic signals, but not a single short pulse.

Using this function try to process various signals and answer the following questions:

1. Find the error in function. Hint: add a constant component to the signal.
2. Why are the spectral amplitudes not exactly equal to the component amplitudes? How to improve the match?
3. Try to process the signals with different sampling periods and signals of different duration.
What changes in the obtained spectra can you mention? How can you explain the observed effects?
4. Try to put two frequencies close in the original signals (but not too close). What do you observe?
When the frequencies are resolved in the spectrum, and when are they not?
Also, try to variate the amplitudes (ratio of amplitudes) of these two close components (harmonics) along with their frequencies.
Which methods of handling such signals can you proposed? Namely, how is it possible to resolve the close frequencies?

To resolve these tasks, try to implement several options:
a) increase n (i.e. pad the original signal with zeros);
b) consider gga function from ltfat package;
c) use window functions. Decide which one is the most suitable?

Sample Solution