# Matlab: Impulse response of linear time invariable (LTI) sine-signal

I'm preparing for a lab in a Signals and Systems course in my university, 5th semester.

I've found old exercise material from the class and since I know some Matlab and have dealt with LTI systems and impulse responses of signals before, I decided to try to tackle them.

Of course, I was completely wrong in my decision and I reached a dead-end.

Here's the first part of the exercise, graded for 50%:

The same sine signal $x(n)$ (of your choice) is inserted into two different Linera Time-invariant (LTI) systems with impulse response $h1(n) = u(n)$ and $h2(n) = u(n-10)$, accordingly.

$\alpha )$ Compare the two exits $y1(n)$ and $y2(n)$

$\beta )$ Are the exit signals periodical?

Some questions before my attempt, along with some of my code:

1: I decided to go for this sine-signal:

Fs=1;
t=0:1/Fs:1000;
x=sin(2*pi*0.01*t);


2: Does "are inserted" imply Convolution?

3: How can you mathematically check for periodicality apart from seeing the repetitions with your eye and calling it a day?

After some work and help from a colleague, I managed to get an answer. For posterity, here it is:

And apparently, yes, we're supposed to use convolution from the fact that we're asked for impulse response.

% Creating our sine-signal
clear
t = -50:50;
Fs = 25;
x=sin(2*pi*(1/Fs)*t);

% Creating our impulse responses. They're unit steps, going from all-zeroes to all-ones.
h1 = [zeros(1,50) ones(1,50)];
h2 = [zeros(1,40) ones(1,60)];

% Calculating the convolusion result of the square signals above with our original sine-signal.
convPlot1 = conv(x,h1);
convPlot2 = conv(x,h2);

% Plot and check our result.
plot(convPlot1)
plot(convPlot2)


Checking for periodicity can be done in many ways. If you are studying signals and systems you will probably sooner or later try at least these two:

1. A classical way is to calculate the signal's autocorrellation (correlation with itself, or convolution with a reverse version of itself). There should be a first maximum at the period length and the maximum should return periodically.

2. You can compute the signal's fourier transform and see if the signal energy seems to be concentrated in equidistant clusters. A periodic signal should be sum of equidistant dirac impulses in the Fourier domain (since all periodic functions have a fourier series expansion each component should be close to zero except for the coefficients in the Fourier series).

Edit If you are curious of claim by user1952009 below (which is correct). Another proof that convolution of a periodic function and another function becomes periodic is a combination of

1. the Fourier transform turns convolutions into multiplication.
2. periodic functions have sparse Fourier transforms (Fourier series).
3. multiplying zero with anything always gives zero.
• periodicity preservation is directly a property of the convolution operator : $x \ast h(n) = \sum_m h(m) x (n-m)$ and if $x(n) = x(n+a)$ then $\sum_m h(m) x (n-m) = \sum_m h(m) x (n+a-m)$ – reuns Jan 1 '16 at 19:13