MATLAB is very helpful tool in signal analysis processing. Discrete-time or digital signals are implemented in the form of arrays (vectors) of values representing for example signal amplitudes. Plotting the signal information in time and/or frequency domain are often used for signal analysis and can be quickly implemented with MATLAB.
In the following several discrete-time signals are given in mathematical notation.
We generate a signal vector (array) for each signal. For better visualisation, a graphical plot for each signal is produced, showing the signal in time domain (horizontal axis = index (n) axis, vertical axis = amplitudes x[n]). Here, an important thing to consider is that the Signal x3[n] has complex amplitude values!
The above code can be extended in order to compute the spectral representation by using the Fast Fourier Transform (FFT) of each signal and to show the amplitude and phase spectrum of each signal. In order to determine the FFT, we use the MATLAB command: fft
As you may have noticed that the spectrum X[k] is in general complex! Hence, the information should be visualised as amplitude spectrum (showing the absolute value of X[k]) and phase spectrum (showing the angle, i.e. the phase information of X[k]). Furthermore, we scale the amplitude spectrum by 1/N in order to get values of Fourier coefficients.