So for this demo,I'm going to talk to you
about parties the signal processing
toolbox with MATLAB
On the agenda today, we're going to have an introduction to
the toolbox going to look at how we can
generate and measure signals. we are
going to look at a signal filtering
example and then two more common
application examples. so firstly as an
introduction I'm sure we all know how
signals affect us in everyday life they
are used in cell phones and medical
devices and GPS systems financial
analytics and then some research areas
as well and then the concept of signal
processing is even found in means.
so firstly I want to emphasize why we
are using MATLAB, so MATLAB is very easy
to use this means it will transform the
way you work. MATLAB lets you visualize
what you want to see in an intuitive way
so when visualizing data becomes as easy
as with MATLAB you're not thinking about
formulas and specific use cases you're
seeing the whole picture and interacting
with the concepts and implications
rather than the maths and the data
the result is that you can focus on
creatively getting the data to work for
you in new ways. so the basic workflow of
MATLAB is shown in this slide
firstly to get the data into MATLAB you
can use files like binary files or Excel
spreadsheets you can get data from other
software applications as well and from
Hardware also which we will look at later
once you have the data in MATLAB
you can analyze the media data develop
algorithms and applications and then
when process the data you can
export it via word documents or PDF
documents or you can convert to C code
if you want to deploy
hardware so for this presentation I'm
only going to focus on the explore
discover section in the middle
so what are the key features of the signal
processing toolbox. the first is you can
generate signals and visualize
them you can perform signal transforms from the
time to the frequency domain and vice
versa you can design analog and digital
filters and analyze and implement them
you can employ statistical functions to
highlight some aspects of your data and
MATLAB has some nice power spectral
density estimation algorithms that can
show you the power spectral density of
your signals now this list is not
exhaustive there are a lot of other
functions that the signal processing
toolbox has as well
so moving on then to a signal generation
example we firstly going to look at how
we can generate some commonly used
things so if we go to matlab firstly we
specify the frequency the sampling
frequency and the frequency of the
signals and then we can just use Bolton
functions like square sawtooth sine and
chirp to plot some known signals in
MATLAB okay so when that is plotted we
can see the result is very simple so if
we maybe want to look at this chirp
signal then we see in the time domain it
doesn't really give us a lot of
information so what we can do is we can
plot the spectrogram of the signal and
then see what the frequency does with
respect to time okay so here we can see
that the majority frequency components
varies linearly with time so going back
how can we acquire and process
real-world signals for MATLAB so the
answer is there are many different ways
here are some of the hardware ways you
can get signals into MATLAB so you can
use the instrument control toolbox to
get data from oscilloscopes and signal
generators then you can use the data
acquisition toolbox to get data from a
USB and PCI protocols and then you can
get data from cameras and from vehicle
toolboxes and also MATLAB has interfaces
for communicating with nearly everything
so the example we're going to the gut is
sunspots so firstly sunspots are
temporary phenomenon we intense magnetic
activity on the surface of the Sun
inhibits the normal conviction so
consequently cooler or dark spots appear
on the surface of the Sun so for this
example we would like to determine the
solar cycle using the sunspots data so
we know the solar cycle is 11 years and
we would like
to verify this using that data so we are
going to look at the time series
analysis and the frequency series
analysis to get the same results so
going to MATLAB okay so firstly if we
plot the number of sunspots per year it
looks like this so we would like to see
where the majority of sunspots live to
do that we can use the fine peaks
function to plot the local Maxima of
each six year period
once that is blotted we can see that the
local Maxima is highlighted with red
markers so in order to get the distance
between them or the period we can use
the DEF function and then just calculate
the mean we see the cycle is ten point
eight six years which corresponds quite
nicely to the known value of eleven
years so we can do the same in the
frequency domain using a discrete
Fourier transform so MATLAB has a
built-in function f of T which computes
the fast Fourier transform the signal so
for this example we're only interested
in the fluctuations so we can remove the
mean from the signal and then only plot
the fluctuations doing that we can see
that the largest frequency component
lies about at 0.09 which is the
reciprocal of 11 so we get the same
result in the frequency domain as well
moving back to the presentation so that
concludes that example
[Music]
looking as senior full string we know
there are various challenges in filter
design like you would like to design
your filter squad rapidly you want to
move through different full two
architectures quite falsely you would
like to have your design process as
streamlined as possible and once you
have designed the filter you would maybe
like to deploy the filter on hardware
devices so you would want to design for
implementation of course MATLAB has
solutions you can select from many
predefined application specific filters
you can design in floating point and
then convert a fixed point to I trade
fast and you can visually explore design
method and analyze responses also you
can generate matlab functions Simulink
models and C code from the filters so
this example we are going to look at out
to analyze an ECG signal in the time
domain an ECG signal looks like this so
we can see there is a linear trend
associated with the signal so firstly we
would like to remove that and then we
would like to remove the high frequency
components because that doesn't help us
in analyzing the signal and then we
would like to compensate the delay
introduced by the filter so this is the
workflow we are going to do for this
example going to MATLAB
so firstly we load the signal into
MATLAB and then we can plot it in the
time domain as shown in the slides as
well so firstly as I said we would like
to remove this linear trend from the
signal to do that we can use the D trend
function so the D trade function as
shown here simply removes the mean value
or linear trend from a vector or a
matrix doing that and plotting in the
time domain again we can see that the
linear trend has been removed okay so
next we would like to remove all the
high frequency components from the
signal in order to design a filter a low
pass filter to do this we'd first like
to know where the useful information of
the signal lies so we can use the P
Welch function which would give us a
power spectral density estimate so for
this example we know that the useful
information of the ECG signal is only
the low frequency components so we can
design the filter to cut off all
frequencies above about 75 Hertz so
there are two methods to design filters
using MATLAB the first is a programmable
method where you can specify the
parameters and then use if desired not
low-pass the next is an interactive
method using an app so that this that is
what we are going to do in this example
to show just how easy it is so we can go
to apps and then select the filter
designer okay so once in the filter
designer we can specify the parameters
like we want a low-pass filter we are
going to use an IR filter for this
example and specify the order as seven
and then the sampling frequency width
for this example is 2000 Hertz
and I specified previously we would like
to cut off at 75 Hertz we can click on
design filter so this gives us the nice
magnitude response of the filter and you
can see below so or above rather 75
Hertz the signal cuts off so we can
click on these buttons at the top to get
more information of the filter like this
just gives in format information you can
see the full TS table and a lot of other
parameters we can see the pole-zero plot
clicking this button here we can see all
the poles and zeros lie within the unit
circle so we can see they are stable
here as well
you can even see the impulse response of
the filter which looks like this so all
of this information of the filter we can
see by click simply clicking buttons at
the top here which makes it really easy
to work and work with and analyze
filters in MATLAB so if we want to use
this filter we can click on file exports
we can export it as an object and call
it D for this example okay so to filter
the signal we can just use filter and D
the variable we just created and
applying that and plotting the new power
spectral density of the signal we can
see that above 75 Hertz the signal gets
attenuated quite considerably so the
filter did exactly what we expected it
to do and now we can plot the filter in
the time domain again and this will give
us this result and we can see that the
filter now delayed the signal by some
margin so in order to remove this delay
we can use the full fault function which
is a very funny name but it basically
just filters the signal
in the forward direction and in the
backward direction as well and thereby
compensating the delay so applying the
fault fault function and plugging the
signal and time domain again we see that
the delays comes at the fore and only
the low frequency components are seen in
the signal so now we can work with this
ECG signal okay this concludes this
example so going back let's have a quick
recap we looked at out teaching an ECG
signal we visualized the power content
of the signal we designed and applied a
low-pass our filter and we compensate
the delay introduced by the filters
[Music]
so next we're going to look at two
common application examples the first is
how to detect distorted signal in noise
so for this example we are going to look
at a non linear amplifier that
introduces third order harmonic
distortion so we can model this
amplifier by using white noise using the
random function and a polynomial of
order three so for this example the
sampling frequency is three point six
kill Urtz and the signal is 180 Hertz so
creating the amplifier signal and then
plotting it over a non noisy signal you
can see this is how it looks with a lot
of added noise spikes so to work with a
signal again we can plot the power
spectral density by using the P Welch
function this gives us this result so
because this is a third order amplifier
we know it will give us a DC components
one fundamental frequency components and
harmonics of twice and three times the
frequency of the signal so we can see
this but we would like to visualize this
a bit better so we can use the fine
peaks function again by plotting the
four highest peaks doing that we can
verify that the peaks are where we
expect them to be and just to make sure
that we have the right Peaks we can see
the components here are DC components
fundamental frequency components and
then two and three times frequency so it
is important to understand how the P
Walsh function works if we would like to
visualize our data in different ways so
the P Wells function divides the signal
into different segments and then
calculates the periodic gram of each
section and then averages by default the
function takes 8 segments with 50%
BLAP for 10,000 samples this gives us
about two thousand two hundred and
twenty two samples per segment if we
decrease this number we can get shorter
segments which results in more averaging
but lower resolution plotting that we
can see the signal is smoother but we
cannot distinguish the harmonics we can
increase the number of samples per
segment and this would give us longer
segments and high resolution but also
more randomness if we plot that we can
see there are higher harmonics but there
is at least one spurious high frequency
peak that is higher in some of the hair
so that concludes this example moving
back the last example we're going to
look at how to remove spikes from a
signal so if we have some if we have the
open-loop voltage across an analog
instrument in the presence of 60 Hertz
power line noise and the signal looks
like this in the time domain we are only
interested in this open-loop voltage and
not these transient spikes of the power
line noise so we can use the mid fault
one function which is basically a
nonlinear digital filtering technique
that steps through the signal and
replaces each value of the signal with
the median of its neighboring values
applying the mid fold one function and
plotting again you can see the results
of the signal is just the smooth signal
and we can work with that very very
simple
moving back then that concludes the last
few examples
and is looking at a summary of what we
did today we saw with the signal
processing toolbox we can perform signal
generation visualization and measurement
we can do signal transformed from the
time to the frequency domain we can
design analog and digital filters to
implement them can use statistical
functions to visualize your data in
different ways and we looked at a power
spectral density estimation algorithm
namely P Welch this isn't the only
algorithm MATLAB has a lot of different
power spectral density algorithms but we
only looked at that one today
probably wondering how can optimum
solutions help me
well optimum solutions is the sole
method X accredited distributor of
MATLAB and Simulink products in southern
Africa the company boasts the wide range
of solutions that are tailor-made for
each problem we also offer training in
all mathworks tools in order to equip
our clients with skills required to
solve business problems optimum
solutions have also have consultants
that work with clients and project
delivery algorithm development and
reporting using the base software
practice the learning paths associated
with this demo is shown here so learning
path is a collection of skill sets that
equip you with the certains competency
so there are two parts you can take once
you learn about signal processing you
can do it with MATLAB or with simulink
for MATLAB you would need the fun MATLAB
fundamentals which would provide you
with basic training then you can do
signal processing with MATLAB course
which will provide you with signal
analysis measurement and visualization
techniques and then as a supplementary
course you can do control system design
with MATLAB and Simulink which would
accelerate the design processes for
closed-loop control systems if you are
only interested in the Similan part of
the course you can do the signal
processing for Simulink and then do the
control system design of MATLAB and
Simulink course as well
so once we are done here there are a
couple of things that you can do if you
would like to enrich yourself you can
click on these links to take you to the
math works website where you can look at
data analysis or algorithm development
alternatively you can download the trial
of MATLAB if you would like to try some
of these examples yourself you can also
ask for support because optimum
solutions provides our customers with
technical support then we are here to
help if you have any questions about any
field specific issue we really strive to
add value to the product and to the
customers you can also visit our website
and look at the data analytics
competency and at the training page so
this concludes this demo I believe I
have made it clear why MATLAB and by
extension the signal processing toolbox
provide very efficient and intuitive
ways to work with data
there's demos Alicia and some others
and there are many more to be discovered
thank you very much