Generation and analysis of vector signals¶
Introduction¶
In this basic example, we will look at the principle of generating vector signals on the example of five discrete sinusoids, we will learn about basic operations on vector signals, as well as the possibilities of their visualisation in time and frequency domains.
The model consists of discrete sinusoidal signal source blocks DSP Sine Wave
,
block Gain
, multiplying the input signal by a constant value,
block Sum of Elements
, summarising the elements of the vector input,
and block Selector
, allocating elements from the vector input.
Generation of multiple sinusoids¶
The parameters of the signal source block are shown in the figure below. It should be noted that in the model we generate five sinusoids at once, setting the values of amplitudes, frequencies and initial phases by vector. In our case, we generate signals of the same amplitude at frequencies of 5 Hz, 95 Hz, 105 Hz, 195 Hz and 205 Hz. And the initial phase changes 180 degrees from from sine wave to sine wave. The sampling frequency of the signal is 500 Hz.
Similar composition of frequency components of a complex periodic signal we could observe in the example Multirate filter, where their superposition resulted in a waveform with outliers and zeros in between. In the current example, we're going to try to reproduce such a waveform.
Spectrum of vector and sum signals¶
Let's display the spectrum of the signal in
in the window Графики
, by selecting
in Меню сигналов
: Сигналы в частотной области
.
We observe five spectra of five discrete sinusoids
at the specified frequencies:
Now let's consider the spectrum of the total signal at the output of the
block Sum of Elements
. We see the spectrum of one signal,
but its peaks are at the same frequencies:
It can be seen that the power level of the peaks in the spectrum of the total signal
is higher than the peaks of individual sinusoids by 6 dB. This is due to the fact
because we pass the vector signal through the block Gain
,
doubling the amplitude of each element of the vector. The operation
multiplication operation is vectorised, the output of the Gain
block is also a
vectorised.
Visualisation of the signal in the time domain¶
Now let's draw oscillograms of the signal in
, by selecting
in Меню сигналов
: Сигналы во временной области
.
We observe on the same axes five discrete sinusoids
with different repetition periods. We can also switch off individual elements of the vector on the legend
below the graph, displaying the signals we are interested in.
The amplitude of each sinusoid at the output of the signal generator is 0.1.
After the block Gain
the magnitude of the sinusoids becomes from -0.2 to 0.2.
Shape of the resulting signal¶
If you reflect in the time domain the shape of the signal at the output of the
block Sum of Elements
, we can observe the expected shape of the signal.
These are impulse emissions of sinusoidal samples with a range from -1 to 1
with dips to zero in between. When five discrete sinusoids.
of 0.2 amplitude are added together in phase, we get the maximum of the total
signal, but more often than not, their superposition results in zero:
We can also plot one of the sinusoids from the block output to the graph
Gain
and we use the Selector
block to
to extract one scalar signal from the vector. The model extracts
the first element of the vector, i.e. a sinusoid with an amplitude of 0.2
and a frequency of 5 Hz.
Conclusion¶
In this model, using the example of a source of five sinusoids, we have learnt the principles of vector signal generation. with the principles of generating vector signals, mapping them in the time and frequency domains, performing vectorised arithmetic operations on vector signals, operations on an array (using the sum of array elements as an example), selection of separate elements of a vector signal.