Hey fellows, in the previous lecture, we read the basics of Laplace transform and now, we want to go into a deep study about the same topic. Usually, it is important to learn all the properties of a mathematical tool to use it well, but we’ll focus on the basic and important properties of the Laplace transform to understand its concepts. Here are these:
Linearity
Time delay
Nth derivative
Frequency shifting
Multiplication with time
Complex shift property
Convolution of the Laplace transform
Time shifting
Time reversal
If you have read the previous concepts clearly, then these concepts should be clear in your mind. We’ll define all of them one after the other, and you'll understand each of them clearly.
We all know what linearity is. Yet, the linearity of the Laplace transform is slightly different. When we apply the Laplace transform to two functions that are multiplied with a constant value, say a and b, then the result obtained is equal to the addition of these Laplace entries and multiplying the respective constant with it. In short, we can say:
“Adding two or more values and applying the Laplace transform does not have any change in the result, but we get the linear output.”
This can be illustrated clearly with the following mathematical representation:
You must keep in mind that no matter how many entries you add, the result will always remain linear.
Laplace equation A time delayed function's transform is the function's Laplace Transform multiplied by e-as, where an is the time delay. We frequently investigate systems as a function of frequency.
One must keep in mind that to apply this property, we multiply the delayed version of a function with a delayed step. For instance,
If
Original function= g(t)·γ(t)
Then
Shifted function= g(t-td)·γ(t-td)
If
td=time delay
When taking the derivative of the Laplace to transform, there is a long procedure. It is stated as follows:
There is a long calculation of the whole statement, but after that, the result follows the formula given below:
So, you do not have to take care of each and every value of a long calculation, simply follow this formula and put the values in it, and you can find the derivative of any degree when dealing with the Laplace Transform.
In some other places, the 1st and 2nd derivatives of the Laplace transform are also discussed as properties, but the key point is, that you can put any value of n in the formula given above and get the required results. We have not mentioned them to make things simple.
The frequency shifting property of the Laplace transform is described as
es0t f(t)) ⟷ F(s – s0)
The result on the left-hand side describes the shift of the Laplace transform.
When multiplying the Laplace transform with the time T, the result obtained is:
T f(t) ⟷ (−d F(s)⁄ds) |
When dealing with the complex number and the Laplace transform, one must keep the following statement in your mind:
f(t) e−at ⟷ F(s + a) |
If you are following our previous series, then you must know what the meaning of this property is. Yet, we can revise it. Convolution is the method in which two signals are folded onto one another in such a way that they produce a third signal. The same is the case with the Laplace transform.
When two functions of the Laplace transform in the time domain are convoluted, we get results that have the multiplication of them within the frequency domain.
As we have read about convolution in the previous two lectures, you can get an idea of how you can check this property. To save time, you can also check it in MATLAB. You just have to follow these steps:
Go to MATLAB.
Write the code for the Laplace transform of the first statement by using the function.
Repeat the same procedure with the other statement.
Write the code of convolution of the results as we have done previously.
Output the results.
Time scaling is a basic property of signals, and when we talk about the Laplace transform, we get to know that after scaling, the variable a from the denominator is shifted into the multiplication; that is, we get the time signal in the frequency domain.
Here is another thing about the Laplace transform. The step function is defined when we use the function of the following form:
u(t) = ( 0 for t < 0,
1 for t > 0)
This statement shows that for the values between 0 and 1, this statement is also known as the Heaviside function.
As you can guess from the name, the Laplace transform can be inverted, and this procedure is called the inverse transform. Once you transform the function from the time domain to the frequency domain (that's what the Laplace transform does), you can simply invert the whole process by using the inverse Laplace and get the result in the time domain again. This technique is useful in a number of applications of the Laplace transform. It is represented as:
f(t) = L-1{F(s)}
Now coming towards the solution to this transform. While checking the table, you can easily find the inverse transform. However, if the solution or the term is not present in the table, you can find this inverse with the help of the partial fraction expansion method.
As in the previous case, inverse Laplace is also performed in MATLAB with the help of functions. Here is the simplest example of this function. Suppose we want to perform the inverse transform of the code that we have discussed before.
Code:
syms t s;
ilaplace(exp(3*t)/(s+13)*(s-2))
Output:
All the descriptions are the same as in the previous case, but you can see we used a slightly different function as
ilaplace(x)
Where x is the value of the question that we have fed into this function. Finally, have a look at the code given next in which I just have merged Laplace transform with the inverse Laplace so that you may understand the whole mechanism.
Code:
syms t a s;
f=exp(a*t) %Question
F=laplace(f) %Laplace Transform
G=ilaplace(f) %Inverse Laplace Transform
Output:
Here, a new thing is introduced in our program that may be new to you. We used the comments and these can be added to any program of MATLAB same as the other programming languages.
Comments in the programming languages are ignored by the compiler at compile time. In other words, we can not add any extra words in programming languages because the compiler does not understand them and we risk an error. So, if a person wants to add details about the steps or wants to add any notes, he or she uses the comments. The compiler then ignores these lines, and in this way, we do not get any errors. Usually, comments are shown in a different color than the code lines (green in MATLAB). To add comments in the program, we simply put a percentage sign % before the notes.
As we have all learned in our matriculation, the partial fraction is the method in which the difficult denominator is solved by converting it into different partial fractions. In this way, it becomes easy to find the values of variables, and after that, the result is recollected into the desired form.
There are different cases in the partial fraction of the Laplace transform and some of them are given next:
Direct real roots
Repeated real roots
Complex roots
Order of numerator and denominator are equal.
Exponential in the numerator
Now, you must be thinking about how inverse Laplace can be used as a partial fraction. Let's have a simple example in which you will learn to solve this case.
Consider the following question:
F(s)= s^2 +3/s^2(s+2)
You have to follow the steps given next:
Write the right-hand side part of this equation on the left side of the equal sign and mark it as X.
At the right side of the equal sign, you have to split the denominator. Here, you can see that there will be three fractions when we split the denominator. These are:
s
s^2
s+2
The numerator is ignored at this point, and you have to put A, B, and C on each numerator of the partial fraction.
Now, simply multiply s with the whole equation and solve them one after the other.
Cancel the values as much as possible.
Solve the equation.
Repeat the previous four steps by placing the 2nd and 3rd denominator values.
You will find the values of A, B, and C.
Put the values in equation X and this is the required answer.
This explanation is just for revision, otherwise, we all know the implementation of a partial fraction.
As you were expecting, MATLAB has the implementation of fractions in just a second. You do not have to do long conversions. Simply put the code in MATLAB and you will get accurate and easy answers in just a second.
Suppose we have the question:
F(s)=(4s+24s^22+48^3)/(s+4)(s+1)(s+2)
Then you will use the following code.
Code:
num=[4,24,48]
roots1=[-4 1 2]
den=poly(roots1);
[r,k]=residue(num,den)
Output:
Here, you can see that we have used a different type of code that till now we have not discussed. So have a look at the description given next:
The term "num" describes the values in the numerator.
The den represents the entries of the denominator.
We used the poly(x) function in which x represents the value that has to be converted into polynomial form.
Here in the place of x, we inserted the values that, before calling it, we stored in the user-defined variable roots1. It was named by us, but you can call it by any other name.
[r,k] = residue (num, den) is the pre-defined function of MATLAB in which we find the values of the variables that we have shown by storing them in num and den.
Always keep in mind that the values that we have stored in the den are the values when we put the s-x=0, the sign of each value is reversed. Moreover, never change the sequence of the numerator or denominator in the pre-defined function otherwise, you will get different results.
Have a quick review of the Laplace transform here:
In data mining, there is a great role for databases and records of previous values. The laplace transform plays an important role there and helps to keep the record in a great way.
All the conversation about the Laplace transform was based upon the application of this transform in signal processing. It is used in the filtering of signals, processing of signals, and changing the domain of the signals.
This transform is used to convert the governing complex equations into simple differential equations.
Not only in probability, but it is also used in the moment and variance as well. It is a necessary topic in most mathematical courses.
In computer ICs, the Laplace transform is used to measure and predict the current and other parameters in a great way. Therefore, it is used in the designing of ICs and delicate circuits in a great way.
Today we have seen some interesting facts about the Laplace transform and read thoroughly about the properties and types of Laplace transforms. We used MATLAB for examples, and we also found the working of this transform in detail. In the end, we have a glance at some basic and simple applications of Laplace transforms.
We've all heard that clicking on links or attachments can lead to identity theft of sensitive, personal information. And while it's true - if you're not careful, you could be leaving yourself open to hackers and other dangers. But what most people might not know is the difference between "hacking" and "data theft". In this post, we outline the steps data security engineers recommend you take to protect yourself from these different types of threats.
Data security engineers are not your everyday IT professionals, so what do they recommend for parts of the population who aren't working in IT?
While some advice might be obvious - if you're on a secure, encrypted site, for example - for regular Internet users, data security engineers often urge people to take this one step further. In general, we suggest that individuals don't just treat a website as secure if they can't see that the website is encrypted with HTTPS , but instead assume encryption is there unless it's explicitly said otherwise.
What this means for you as a regular Internet user is that before you click on a link, you should pause and consider if the destination is where it says it's going to take you. If in doubt, search for the destination site to find out where it lives, then visit the site from there instead of clicking the link.
Two-factor authentication adds an extra layer of security in addition to your password by asking for another "factor" to activate your account - most commonly, a number sent either via text message or generated by an app on your smartphone.
Using two-factor authentication, you get maximum protection of your data in your account, protecting yourself from both hackers who have your password and malicious advice that directs you to a fake login page. And once you're there, using two-factor authentication can stop attackers from taking over your account entirely.
Computer security is a constant battle between developers on one side who are trying to make their applications as secure as possible and attackers on the other who are trying to exploit flaws in those applications. To keep up with the latest patches, developers recommend that users keep their software up to date with the latest versions - either automatically or manually.
Users also have a choice to control which applications automatically update. To stop them from installing unwanted software, users can opt out of automatic updates through their OS's control panel. And to ensure the latest security updates from their developer, developers recommend that users always install updates when told.
Since browsers are the foundation on which websites are built, regular Internet users need to keep their browsers current with the latest patches, features, and security fixes. And that means staying up to date.
For users who find themselves caught in an old browser, or for those who might have trouble keeping track of updates, developers recommend taking advantage of automatic browser updates . Then, when updates are available, the browser will notify you and you can update from there. With automatic patches and feature updates, your browser will ensure you're always current with the latest security features to protect your devices and information.
With all the benefits of social networking and sharing, it's easy to feel comfortable sharing each other's information with a promise of trust.
For regular Internet users putting personal information online for others to see, data security engineers think it's important to make sure that when you do share your information online, you're doing so for the right reasons.
The deciding factor here is whether or not you have control over the information and how to delete it from the site when you decide later that you don't want it there anymore.
If you do have control over the information and can delete it from that site, then data security engineers don't see any harm in sharing.
If you don't have control over the information though and aren't allowed to delete it, then data security engineers think it's important to consider other ways of getting your point across - perhaps by taking a picture with your smartphone and posting that online, rather than posting another selfie or a picture of your cat.
Regular Internet users who are constantly using smartphones and tablets are not only making themselves vulnerable to hackers when they're out in public but also at home with their devices. And data security engineers suggest that if users aren't already encrypting their devices, it might be time to start.
Locking an Android device with a password gives users a greater layer of protection over their phones and tablets. Encrypting laptops and desktops can also prevent someone in the same household from accessing your devices. And data security engineers recommend making encryption automatic for all of your cloud storage services like Dropbox and Google Drive since this makes recovery much easier should something go wrong.
While most mobile apps are smaller and more focused than larger software systems, it's still important for regular Internet users to choose the ones that offer security features over those that don't. And for those that do offer features, it's important to make sure they're useful and useful only in your specific situation.
Data security engineers suggest taking a look at reviews of any apps you're considering installing first - both those that are free and paid. Just because an app looks like something you might want isn't always the best reason to install it. After all, what good is an app that can protect security if it can't protect your information?
These steps should keep your online information and devices secure. But sometimes, no matter how prepared you are, problems can still happen. For those times when things do go wrong, data security engineers suggest taking a look at cyber liability insurance. So long as you're not violating the terms of service of any sites or apps that you might use - or ignoring the advice of data security engineers - then your policy should protect you if something happens.
Till now, we have read about the basic concepts and functions in the signal and system, but let’s have something that is more practical and practice each and every topic thoroughly because if you have the understanding at each point, transforming will become an interesting game for you.
Keep in mind, that transforms are an important topic in signal processing, but they were traditionally taught in the same way they were discovered: through calculus. This approach, however, does not reveal the true purpose of the transforms or why they are desirable. Well, let’s check the topics that we are going to learn about today:
What are transforms?
Which common transforms are used in signals and systems?
What is the Laplace transform?
How can you implement the Laplace transform in MATLAB?
What are bilateral and unilateral Laplace transform?
What is the difference between these two types?
We are reading very simple and handy information about the signal and system in this tutorial, but practically, signals are used everywhere in a very effective way by using a great number of values and merging them in an effective way. This becomes very complex to understand, even if you are using complex software such as MATLAB. To simplify, general work transforms are made so that not every time, users have to make complex calculations. The good thing is, that transforms are used to deal with the signals in the different types of domains. You can take transforms as a formula that does not require calculating and proving every time. You just have to follow the procedure and put the values in the formula, and you are good to go.
The main reason we need transforms is that we want to have a different view of our time domain signals, highlighting characteristics that are difficult to see with the naked eye. It's similar to switching from rectangular coordinates to polar coordinates when the problem demands length and direction.
Transforms are not necessary to deal with the signal and system, but
They make signal formation easy and convenient.
These are the best ways to deal with the system.
Computation and analysis have become interesting and convenient.
The results are easy to understand and, in this way, there are fewer chances of errors.
There is more than one transform because different scientists worked in this field and invented these transforms. The good thing about these is, that you do not have to have a grip on the knowledge of different planes and domains, you just have to know the basics of the domains and apply these transforms, and by following simple steps, you are good to go. We will learn about the following transformations in this series:
Laplace Transform
z-transform
You will also learn the types of these transforms and all the important information about them in a very simple and easy way. These also have some subtypes, and we’ll make sure to discuss them, but with all the necessary information that is related to this course and will avoid the extra points.
The Laplace transform is named after Pierre Simon De Laplace, a great French mathematician (1749-1827). The Laplace transformation is very important in control system engineering. Laplace transforms various functions. In analyzing the dynamic control system, the properties of the Laplace transform and the inverse Laplace transformation are both used. We define the Laplace transform as
“Laplace transform is the study of continuous-time signals in the frequency domain. It is done by converting the function of a real number (usually t) into the function of a complex number (say s) in the frequency domain.”Mathematically,
You can observe a small s in the formula. It is a complex number and it is defined as
s=σ+jω
Here, you can see that s contains “ω” which is a frequency component. And hence proved thatThe interesting thing about the Laplace transform is that it is sometimes simply called a one-sided transform or a one-sided Laplace transform because the limit does not start from minus infinity to infinity. Instead, only zero to positive infinity is used in this transform.
The Laplace transform converts the signals into another plane called the s-plane in which the signal is obtained in the frequency domain. This s-plane is important because it allows us to convert the differential equation of the time domain signal into an s-domain algebraic equation. For both humans and machines, algebra is simpler than calculus. As a result, using the Laplace transform to transform the signal makes it easier to perform certain operations on it.
The above formula provides us with some important pieces of information that we are discussing below:The formula states that we have a function of time denoted by f(t) that, after the Laplace transform, gives us the function of Laplace transform F(s) that is a complex function.
Observe that we use a lower case function when we talk about the function in a time domain and after the Laplace transform, all the notations are in capital letters, indicating that the transform has been applied to it.
This transform lies between the positive infinity and the zero value, and therefore, you must keep in mind that the results, after the Laplace transform, do not have the time variable in the result. (You will see it when we discuss the table in the next sessions).
Since the lower limit starts from zero, we’ll be interested in knowing the behavior of the function only for t≥0.
Given that the integral's upper limit is, we must wonder if the Laplace Transform, F(s), even exists. The transform appears to exist as long as f(t) does not grow faster than an exponential function.
As we have said earlier, the Laplace transform has great value in signals and systems and other mathematical and, therefore, MATLAB has a pre-defined function of Laplace so that you are not restricted to writing the whole code all the time. In this way, using the function is clean, easy, and less error-prone.
Till now, we have studied the signals and provided you with the numerical appearance with the help of MATLAB, but today, the calculation that we are making will be in numerical form. We can also plot these as signals, but usually, the Laplace transform is in the form of calculation, as you already have a great number of numerical examples in your syllabus related to the Laplace Transform.
The function used in MATLAB has the following syntax:
laplace(x)
Where x is the value for which the laplace transform is required. Here, the thing to remember is, that the first letter L is small here. Let's check the example to clear up all the discussion about the Laplace transform.
Here is a simple example through which we will prove all the points that we have made till now.
Question:
Find the Laplace transform of the following equation:
f(t)=e^at
Code:
syms s t a
f=exp(a*t)
F=laplace(f)
Output:
Here, you can see that the long calculations and formulas are condensed into a simple program of just three lines, and we get the correct output easily. Let’s understand this code.
First of all, we declared the variables that we are going to use in our Laplace transform. For this, we use syms. Any string after this is declared as a variable. If we do not do this, MATLAB will show an error and say that it does not have any information about that particular variable.
In the second step, we specified the equation of the question. In MATLAB, the exponential function is defined by using the exp(x) in which the x is the value that comes in the exponential area of the equation as you can see in the question. We stored this value in the variable f. You can use any value.
In the last step, we used the formula for laplace as it is a pre-defined function of MATLAB. In the equation, we just put in the value of the question that we had stored in the f. As a result, MATLAB will easily provide you with the answer and you do not have to go into deep calculations.
Enjoyed this example? Let’s move to a complex one.
Code:
syms t u a
f=u*sin(a*(t-2))*(t-2)
F=laplace(f)
Output:
You can see the same procedure is followed by us in this example. We put a little complex equation in f and got the results as expected. The great thing is, that MATLAB provides us with the value of each term on its own without demanding us to clarify its answer. Always keep in mind that:
There is a difference between capital and small letters. That is, MATLAB is case-sensitive.
The variable in which you store any information does not need declaration at the start but if you are using the variables in the equation, you have to specify them first so that MATLAB can distinguish them from the other variables and use them in the equation.
It is important to understand the sequence in which we are going to study the Laplace Transform because the things are linked with each other, and at a point, you will feel that is why you are learning so much about that point, and after that when you learn the application of that particular thing, you will have the idea of that point.
The Laplace transform can be solved with the help of a table that we will learn with great detail, and to understand that table, you have to have clear initial concepts. This table contains the properties of the Laplace transform that we’ll discuss in detail in the next session.
Here is a different way to solve the Laplace transform. Recall that the Laplace transform that we have read about till now is unidirectional; that is, the limits of the integration start from zero to positive infinity. Yet, now we are dealing with another type of Laplace transform that has a total limit. Yes, you are right, the limits of the integration are from negative infinity to positive infinity, and, therefore, it behaves differently from the one that we have discussed before. Here, we are denoting the Laplace transform with different variables so that it will be easy for you to memorize the difference in the behavior.
This type of transform is also known as the two-sided Laplace transform. Having a greater range of integration, this transform works a little differently.
Unilateral Laplace Transform |
Bilateral Laplace Transform |
The limits of interaction are taken from zero to infinity. |
The limits of integration lie between positive infinity and negative infinity. |
Restricted to the casual time function. |
Restricted to casual time function or non-casual time function. |
Takes the initial condition of the system in a systematic or automatic approach. |
Initial conditions are included with the additional inputs. |
Less complex |
More complex |
Fewer applications |
More applications |
People dealing with the practical applications of signals and systems have deep experience with both of them, and they use both of them in their work according to the nature of their work. Both of these have their own pros and cons, but once you have a clear concept of the unilateral Laplace transform, you can easily understand the other type.
So today we started an important topic in signals and systems named “Transforms” and studied the introduction to the Laplace transform. We saw some codes in MATLAB, as an example, and also read about the difference between the bilateral and unilateral Laplace transforms. The next lecture is going to be full of action and will see some applications of transforms as well.
Hey geeks, welcome to the next article of this series on signals and systems. In the previous lecture, we saw the basic types of convolution and learned about convolution in MATLAB. This time, we are going to enhance some concepts about it by learning about the properties of convolution and by adding some important pieces of information about the same topic. Have a look at today’s concepts:
What are some basic properties of convolution?
What is the correlation?
Discuss some types of correlation and their implementation in MATLAB.
What is the difference between convolution and correlation?
How convolution is used in different areas of science and how different departments are using this technique to control the parameters efficiently.
Once you have a clear idea of linear/circular convolution, you can easily understand its properties. These convolution techniques that we have discussed till now are used in many fields of signal processing, and if you have a grip on their concepts, you can easily use it anywhere they are applicable.
There are three main properties of linear convolution:
Commutative property
Associative property
Distributive property
This property says that linear convolution is commutative. It means that no matter what the sequence of the signal or function is that is involved in linear convolution, the result will remain the same.
Mathematically,
x(n)*h(n) = h(n)*x(n)
It means whether you convolve the second function and multiply it with the first one or vice versa, the result will remain the same.
We can replace a succession of Linear-Time Invariant systems with a single system pulse response that is equal to the convolution of the impulse responses of the individual LTI systems using the associative property of convolution.
Mathematically,
y(n) = [x(n)*h1(n)] *h2(n) = x(n)*[h1(n)*h2(n)]
This property implies when there are more than two signals involved in convolution.
This property also depends upon more than two functions. It is a combination of addition and convolution of the signals. It says that the result of the addition of two signals and then convoluting them with the third one is equal to the addition result of the convolution of each signal separately from the third signal. If it is not clear to you with this statement, have a look at the equation.
Mathematically,
x(n)*[h1(n)+h2(n)] = [x(n)*h1(n)] +[x(n)*h2(n)]
Correlation is the measure of similarities between two signals, functions, or waveforms that are usually used in signal processing. In other fields of science, a correlation has other meanings. Yet, in signals and systems, correlation compares two signals and provides the similarity. It is introduced as:
“In signals and systems, correlation is the procedure to find the similarity between the values of two signals, and it also measures the extent of this similarity in such a way that zero correlation means no similarity and vice versa.”
This is an important procedure, as in signals and systems, all the work is done with the help of waveforms or signals, and correlation helps to figure out the extent of similarity between them.
Let’s take two signals out of one is x(t) and the other is y(t), then the correlation, denoted by r, is obtained by using the following formula:
rxy(τ)= ∫∞−∞x(t)⋅y(t−τ) dt
Keep in mind that there is a difference between the relation of x to y and y to x. Therefore, changing the position with the r means we have to change the values on the other side of the equation as well. As you can see, the correlation is done by using the dot sign between the signals.
If you have the idea of convolution that we discussed in the previous lecture, then you must be familiar with the other components of the formula as well.
Based on how the correlation is solved in different ways, the correlation is broadly divided into two different types:
Autocorrelation
Cross-correlation
The first type of correlation is the one in which the signal is compared with itself. Here is the formula for it:
rxx(τ)=∫∞−∞x(t)x⋆(t−τ) dt
Now the question arises, how can a signal be compared with itself to find the similarity? Well, as you can see clearly in the formula, the signal x is correlated with the time-shifted version of the signal itself. In this way, we can say, auto-correlation is a uni-signal procedure.
Code
x=[1 2 4 7]
h=[4 7 8 1]
a=xcorr(x,h)
subplot(2,1,1)
stem(a)
title('Auto-Correlation')
xlabel('Time / The Engineering Projects')
ylabel('Amplitude')
grid on;
Output
The measure of similarity or coherence between one signal and the time-delayed version of another signal is defined as the cross-correlation between two different signals, functions, or waveforms. The degree of relatedness between one signal and the time-delayed version of another signal is indicated by cross-correlation.
Code
t=2:0.1:1
x=[1 2 4 7]
h=[4 7 8 1]
a=xcorr(x,h)
subplot(2,1,1)
stem(a)
title('Correlation')
xlabel('Time / The Engineering Projects')
ylabel('Amplitude')
grid on;
Output
You can see it is a simple program with two signals and by using a simple formula of correlation as:
xcorr(i,j)
Where i and j are the signals, we can have an accurate correlation between the signals. There are some cases in which more than two entries are possible in the same formula, and MATLAB works best in that too.
Always keep in mind that we are using the stem command to show the signal in the discrete format, but you can also have the results in the continuous time format by simply putting the value of the result (here a is the result) in the plot format to get the desired result.
Convolution |
Correlation |
|
Introduction |
Overlapping two signals to have the third one. |
Finding the relation between two signals |
Denotion |
It is denoted by a (*) sign between signals |
It is denoted by a dot (.) between signals. |
The number of signals |
Always two or more |
Maybe 1 or more |
Types |
Linear convolution, circular convolution |
Auto-correlation, cross-correlation |
Functions in MATLAB |
conv(a,b), cconv(a,b) |
xcorr(a,a) ,xcorr(a,b) |
You will also see some other differences between these two at some points, but according to the point of view of the course we are studying, these applications are more than enough to understand. It is an important question that is usually asked during exams, and you must go through each of these points to clear up the concept.
As we have said earlier, convolution is an important topic in signals and systems. Now, we are moving toward its applications so that you will get an idea of why we were emphasizing the importance of this topic. Here are some important and interesting applications of convolution techniques in signals and systems.
Image processing
Customizing patterns of signals
Audio processing
Polynomial multiplication
Artificial intelligence
Optics
We are going through each of these points consecutively because if you are familiar with the convolution technique as we have given the details in the previous sections, you are going to enjoy each of these. We are not going deep into the discussion because the deep discussion is not in the context of this course. You just have to understand the information and you will be amazed to know how simple topics can be useful in different ways.
First of all, let us discuss the way in which convolution changes the quality of the picture in any way you want. To understand it well, let’s discuss some points.
Image processing is based on tiny pixels, and the number of pixels decides the quality of the picture.
Operations on the images in a computer system are processed in the form of 2D arrays.
The processing of images is done by using matrices of different sizes, and the smaller one is called the Kernal, and its size is important in this process. Through the convolution process, we can change the edge privilege (as shown in the picture), and in this way, we can change the edge style with this technique.
In the same way, convolution is used to sharpen or smooth the image according to the requirements. Another application of convolution in image processing is to blur the image to maintain the security or any other intention behind the convolution.
As we have mentioned in the theoretical section before this, we can deal with the impulse response of the signals in convolution and if a person has deep knowledge of it, he can customize the pattern effectively using signals according to their own choice.
Similar to image processing, audio processing can also be controlled with the help of this technique. Audio signals can be mixed to have the third one, or you can simply use them to enhance the quality of your sound signals.
"Convolution reverb" is the technical term for the process of digitally simulating reverberation. It allows you to convolve the known impulse response of an area with that of the desired sound to simulate the reverberation effect of a specific area.
You have probably seen the multiplication of polynomials in your early classes, and you must be wondering why we are mentioning this term here. Keep in mind that polynomials may be very complex at a high level and it may become a headache to solve them correctly. Luckily, convolution can solve such multiplication within seconds by converting these polynomials into a matrix and solving them accordingly. In the end, when we have the values of each polynomial, one can also use the calculation further to use them for other purposes. Have a deep look at our description. We are talking about the multiplication of polynomials, but in real life, the convolution is carried out instead of multiplication, and we get the desired results.
Convolution are used in artificial intelligence and e all now it is an emerging technique in which many people are working. Artificial intelligence works by using different types of networks of elements, and these networks are associated with the parameters that are known as “weight”. These weights are somehow associated with the convolution process, and in this way, we can change the influence of a particular node at a particular output.
In the field of optics, where the major function is with the help of light and small details matter a lot, convolution is an effective way to change the parameters through which light is controlled. In this way, experts know how to control the light with the help of convolution.
The diffraction pattern in optics depends mainly upon two types of patterns of light:
Slits
Circular shape
And by carefully controlling these two parameters through convolution and other techniques, experts are doing great in the field of optics.
It was an interesting lecture today where we learned some important properties of convolution and gained a piece of great knowledge about correlation as well. For me, learning about the application of convolution was an interesting way to highlight the importance of my learning. You must go through some other points on the same topics as your homework. Now we are moving towards a relatively complex topic but do not worry, we are going to learn this step by step by mentioning all the basic and necessary information. In the next lecture, you will come across some different types of transforms in signal and system processing, and you will understand these if you have a little information about the time domain and frequency domain. So go through these, and have a great day.
Hey pupils, Welcome to another lecture of this series on signals and systems, and this is the time to learn an interesting topic in which you are going to learn about the convolution of the signals. In the previous sessions, we have learned basic operations on the signals, and this time, you are going to know the convolution of the signals and different criteria that are related to this topic. Have a quick view of the concepts that will be clarified in this lecture:
What is convolution?
What are some basic types of convolution?
How can you define the properties of linear convolution?
How can you implement convolution in MATLAB using function and without function?
What is the difference between linear and circular convolution?
Convolution is a mathematical operation and it is widely used in signals and systems by using a minimum of two signals at a time. The basic definition of convolution is:
The term "convolution" refers to a mathematical process combining two signals by overlapping them to produce a third signal.
It is important because it establishes a connection between the system's input signal and the impulse response of the system, which determines the system's output, which is utilized to provide a relationship within the LTI system.
Before going into details of the convolution, you must have the idea of shifting and scaling that we have discussed before in this series. Let’s recall them.
"Time shifting" refers to moving a signal forward or backward in time. The time variable in the function is multiplied by the shift or subtracted from it to do this."
Hence, convolution is an integral function that is used to measure the amount of overlap of one function when it is shifted over the other function.
If the definition of convolution is clear to you, then you can easily understand the formula for it.
We all know that there are two types of signals and, therefore, there is a different representation of the formula of convolution in each type.
Convolution of a continuous-time system:
Where,
y(t) = convoluted result
x(t)= 1st function
h(t)= 2nd function
Convolution for a discrete-time system:
Similar to the 1st case,
y(n) = convoluted result
x(n)= 1st function
h(n)= 2nd function
The steric sign here represents convolution, and it is the most important part of this formula. Do not be confused with the symbols of t and k in continuous and discrete signals, respectively. These are the dummy variables of the result so that the input and output representation must not change.
We are not going into details of the derivation but for the clear concepts, let’s solve the example to have practice.
Basically, there are two types of convolution that are used in signal and system. These are
Linear convolution
Circular convolution
A brief description of each of them is given next:
This is the basic type of convolution and is defined as:
“The calculation of the output of any Linear-Time Invariant (LTI) system, given that system's input and impulse response, is done with the help of a mathematical procedure known as linear convolution.”
Till now, the properties and procedures that we have discussed were related to linear convolutions. One thing that must be kept in mind is, that the arrow on the values of x(t) and h(t) indicates the zero position of the function. If this arrow is not specified, then by default, the first value is the zero value.
You will find different formulas to have the convolution of signals, but here, we are providing you with the basic and easiest way to solve the convolution without any confusion. Just follow these simple steps to get the convolution.
Replace T with t
Time reversal in h(t)= h(-t)
Time shifting in h(t)= h(t-t)
Multiplication of h(t-t) with x(t)
Integration of the result by taking the limits from minus infinity to infinity
Keep in mind, in all the steps, the value of x(t) remains the same and just t is replaced by t i.e, time reversal and time shifting do not apply to x(t) while you are using the convolution.
The other type that I found more interesting in the convolution of signals is circular convolution. This type can be performed using two different methods, and by observing the procedure of each type, you will understand why this type is called “Circular” convolution. The total number of samples in circular convolution is equal to the maximum number of values in x(t) or h(t). Have a look at both of these:
Concentric circular convolution
Matrix circular convolution
We are going to discuss both of them in the next section.
Here, you need a circle for each signal or function. In this way, you will have two circles. Follow the steps from the beginning as mentioned below:
Draw a big circle on the page and write the values of x(t) on it at regular intervals.
Draw a relatively small circle inside the first one and write all the values of h(t) on it at the same regular intervals.
Multiply the respective values of both the circles and at the end, add them all. You will get a number.
Now, draw the same circle once again but this time, you have to move the internal circle (the one with h(t) values) one place anti-clockwise and then repeat the above procedure till you get all the values.
The matrix multiplication, as the name implies, consists of two matrices having the values of x(t) and h(t) respectively. The simple steps involved in this method are:
One of the given sequences is repeated, one sample at a time, to produce an N X N matrix.
The other sequence is shown as a column matrix.
The outcome of circular convolution is obtained by multiplying two matrices.
Here comes the action. You have seen that there were different ways of convolution, and honestly speaking, these procedures are long yet easy. MATLAB has built-in functions for convolution so that you may get the answer to long and time-taking calculations in just a bit. You just have to simply input the values, and tell MATLAB that you want to do the convolution of this signal. Let’s implement all the discussions in MATLAB and get the instant and authentic result of convolution there.
Fire up your MATLAB software.
Go to live editor or command window to write the code.
Click the “Run” button.
Save program.
There is a built-in function in MATLAB that is super easy to use, and you do not have to go deep into the procedure. You just have to simply provide the input signals and use the convolution function. If x and h are two signals that have the values, then using this function, you can easily convolute them as
conv(x,h)
At the end, you just have to simply put this value in the y variable so that you can plot or stem it easily. Here is the code and output.
Code | Output |
x=[1 2 3]; h=[1 4 6 8]; y=conv(x,h); stem(y) title('Convolution using function') xlabel('Time / The Engineering Projects') ylabel('Amplitude') grid on; |
|
It may come into your exam that you are required to perform the linear convolution but without the help of function. Usually, it happens when the instructor wants to check the knowledge and concept of the student. So here is a simple program for this.
Code | Output |
x=[1 2 3]; h=[1 4 6 8]; m1=length(x); m2=length(y); subplot(2,2,1) stem(x) title('x') xlabel('Time') grid on; subplot(2,2,2) stem(y) title('h') xlabel('Time ') ylabel('Amplitude') grid on; a=[x, zeros(1,m1)]; b=[h, zeros(1,m2)]; for i=1;(m2+m1-1) y(i)=0; for j=1:m1 if(i-j+1)>0 ylabel('Amplitude') y(i)=y(i)+a(j)*b(i-j+1); end end end subplot(2,2,3); title('Convolution without function') xlabel('Time / The Engineering Projects') ylabel('Amplitude') grid on; |
|
Circular convolution can also be done with the help of function and without it as well. Of course, it is easier to use the function, but in some cases, if you do not want to use the function, it is also possible to do it without the help of the function. The difference between the formulas is, that the circular convolution involves the third parameter as well. This value is obtained when the total number of values of signals is compared and we get the maximum value. For a practice point of view and to clear up the concepts about the topic, we are also using it without any function.
Code | Output |
x=[2 2] h=[1 1 1] l1=length(x) l2=length(h) N=max(l1,l2) a=cconv(x,h,N) subplot(2,1,1) stem(a) title('Circular Convolution with Function') xlabel('Time / The Engineering Projects') ylabel('Amplitude') grid on; x=[x zeros(1,N-l1)] h=[h zeros(1,N-l2)] y=zeros(1,N) for n=1:N for m=1:N j=mod(n-m,N) j=j+1 y=y+x(m)*h(j) end end subplot(2,1,2) stem(y); title('Circular Convolution Without Function') xlabel('Time / The Engineering Projects') ylabel('Amplitude') grid on; |
|
Similar to some other functions, length is also a function of MATLAB that stores the output of the number of values that are fed into this function. Let's suppose if the number of elements on the x-axis in a signal is ten and we feed the signal into this function, then it will provide us with the length of 10. It may seem simple, but in complex signals where a hundred or thousand values in a signal are used, this function proves very helpful.
Have you observed a function “Max” in the code? It is a built-in function of MATLAB that compares the entries and provides you with the entry (signal in our case) with the maximum number of values. Usually, the answer is then fed into a variable so that we can use the result of this max function anywhere without any difficulty.
For your information, we must share that there is another function named "min", and as you can guess, it does the opposite work. Two or more values are given to this function as well and it compares and then provides the minimum value between these two. It may seem a small task but if used correctly, these functions give us control of many useful things by using them in our program.
Linear Convolution | Circular Convolution | |
Complexity | Less Complex | More Complex |
Shifting | Linear Shifting | Circular Shifting |
Numbers of samples | N1+N2-1 | Max(N1, N2) |
Types | Not common types | Concentric circular convolution, Matrix circular convolution |
Formula in MATLAB | conv(a,b) | cconv(a,b) |
Convolution is an important topic in signals and systems as it is used to overlap the two signals on each other in such a way that a third signal is obtained that is different from the first two. We have read some important properties of linear convolution and also seen the performance of each type with and without the function in MATLAB. The purpose of providing the program of convolution without function is to clearly describe the concept and the method of convolution. If you have any type of question regarding the topic, you can contact us.
Hello Pupils, We are learning about signals and systems, and till now we have learned some basic information regarding signals, but we know a little about systems till now. We have learned about the system in our previous lectures. To have a clear concept, we have arranged this tutorial in which we are studying the systems and their classification. Have a quick glance at today’s topics:
What is a system?
What are the various types of systems?
What is the principle of homogeneity?
What is the principle of superposition?
How can we compare each type while keeping their differences in mind?
To keep things simple, we’ll also have examples of some of these signals. Yet, the first thing that we are going to do is to revise the basic definition of the system so that we may move forward.
A system is a closed connection between the input signal and the output. All the procedures and techniques required to convert the input into output are called the system, and if we talk critically, then the basic definition of a system is:
“A system is a collection of components that, when interconnected, provide a signal that is proportional to the signal that was fed into the system.”
To understand, keep in mind, that the system has the input where the data is fed, then different procedures take palace on that data, and as a result of this procedure, we get the output from the system.
As with signals, systems also have some types, and these types are clearly classified for convenience. We will go through some basic types and will try to have a clear concept through discussion and examples.
There are different ways to define the linearity of the system, but the easiest one is, that a system is called linear only if it follows:
Principles of homogeneity
Principle of Superposition
We’ll define both of them one after the other in detail.
According to the concept of homogeneity, a system that produces an output y(t) for an input x(t) must also provide an output ay(t) for an input ax. This is the condition that must be met for the system to be considered homogeneous (t).
According to the concept of superposition:
“A system that produces an output of y1(t) for the input of x1(t) and output of y2(t) for the input of x2(t) must create an output of [y1(t) + y2(t)] for the input of [x1(t) + x2(t)]. Similarly, [y1(t) + y2(t)] for the input of [x1(t)], and implies any number of different signals in the system. "
Well, is it confusing? Do not worry because we are discussing it in simple words. Consider the case when the system has more than one signal in it. If we provide it with 3 signals (let’s say) at the input, then the output contains the collective effect of all the signals that we were expecting from each and every signal by adding them.
It may make no sense at the time because every person, after using their commonsense, can make this decision on their own, but keep in mind that these types of principles are highly effective in solving the complex problem of calculations.
As a result, when we plot the graph of a linear system, we find a simple and clear graph that is usually straight in line. It is the reason behind calling them “linear”. It is usually easy to deal with the linear system as compared to the other type that is non-linear. The reason behind this will be discussed in just a bit. Before that, have a look at the diagram given below:
On the other hand, if the system does not obey the principles of superposition and homogeneity, then it is called non-linear. It is not possible to develop a general differential equation of finite order that can be utilized as the mathematical model for all systems when dealing with nonlinear systems; this is because such an equation would be impossible to solve. This is due to the fact that there are numerous distinct paths via which nonlinearities might emerge, and these paths cannot all be mathematically expressed using the same form. In addition to this, it is essential to keep in mind that the concept of superposition cannot be applied to nonlinear systems.
Let’s talk about a very simple and obvious type of system. A system is called a continuous-time signal if the input given to it, and the output obtained from it, both are continuous-time signals. The operations done on the input do not change the form of the input signals and hence the output is not affected in its shape and type.
A simple example of a continuous-time signal is an amplifier in which the input is analog in the form of voice. Different procedures occur inside the system (amplifier), and from the output, an amplified voice (analog signal) is obtained from it.
As you are expecting, a discrete-time system is one in which the input given to the system and the output obtained from the system, after different procedures, are in the form of discrete-time signals. If in any case, the system changes the signal from discrete to continuous, then it will not be a discrete-time system.
Micro-processor is an example of a discrete-time signal because all the processes that occur in the micro-processor are based on just two numbers that are zero and one and the output, after different operations, remains in the same format.
In some cases, the same results can be obtained from the output of the system that was fed into its input signal, and such systems are termed invertible systems, as the name implies. We define them as:
“A system is said to be an invertible system if it is designed in such a way that the input, that is fed into the system goes through some changes and these changes can be converted into the original signal again by using the different procedure and the input is equal to the output.”
Practically, an invertible system is obtained by using a system in which, in addition to the simple system, an inverter or any other device, that has the opposite mechanism is cascaded to obtain the same input and output.
The system in which the input and output are not equal is called non-insertable. We define them as:
“A system is said to be non-invertible if the effect of the system, exerted on the input signal, can not be inverted. No matter which procedure you are following inside the system, you will get different inputs and outputs. “
Time-Variant systems are those whose output depends upon time. We know that every signal has time on the x-axis but keep in mind, in a time-variant system, a signal depends upon the change in time.
The example given below represents the case of a time-variant system:
y(n)= x(-n)
The system is said to be time-invariant if the output of the system does not depend upon the time of the system.
Consider an example in which the output is called y(t) and the input is represented as x(t). Then the equation given below presents the time-invariant system:
y(t)=x(t)+x(t-1)
Here is another type of system. We all know that static means motionless or unchanging condition. A static system is one that depends upon a particular result at a particular time and it does not have any relationship with the previous or future results.
“A static system is the one that depends upon the present situation only and does not have any mechanism to store the past or future value because it does not need to store these values”.
𝑐(𝑡) = 𝑟(𝑡)
𝑐(𝑡) = 2𝑟2(𝑡)
In these examples, the whole system depends upon the time at a particular instant, and it does not have any concern with the previous or upcoming value. This will be more clear when you look at the example of the dynamic signal in just a bit.
Dynamic means anything that is not stationary. In the case of signals, the dynamic signals are the ones that depend upon the present, past, and future values of the signals. Have a look at the definition:
“A dynamic system is one that can not be achieved by using the present values of the signals only; instead, they also depend upon the future and past values, and therefore, they require memory to store the previous results."
A simple example of a dynamic system is the capacitive system. The capacitor is used to store the charges, so they are also used to store the memory in computers, and the discharging process depends on the number of charges stored an instant before. Therefore, we consider it a dynamic system. More examples are inductive circuits, delay circuits, accumulators, etc.
Have a deep look at these signals. These are the ones that totally depend upon the present and past values of the signal but do not have any concern with the future values.
Keep in mind, that these are not the same as the static or dynamic system, but are slightly different from them.
In non-casual systems, the system depends upon the past, present, and future values, and if any of them is missing, the system is not able to work properly.
We are going to end by discussing the summary of the whole article. We have ready many types of signals and, similarly, systems also have some classification. Most types of systems have an opposite type as well and for convenience, we have discussed them one after the other so that you may compare them and have a clear idea about them. We have discussed some common types of systems and the key points of each type are given below.
System |
Features |
Linear system |
|
Non-linear systems |
|
Continuous system |
|
Discrete system |
|
Invertible system |
|
Non-invertible system |
|
Time variant system |
|
Time-invariant system |
|
Static System |
|
Dynamic System |
|
Casual system |
|
Non-casual system |
|
There are numerous types of systems in which the type of input and the type of output are strongly examined to know the particular type of system. For the best understanding, keep the difference between each of them in mind. There may be other types as well yet for this course, these types are more than enough. You should go through them and find the examples of each of them by summing up your concepts and common sense. You must keep in mind, that a system can be of more than one type at a time. We will go through the next topic in the next step.
Hey peeps welcome to The Engineering Projects. This is the third lecture of this series, and till now, we have discussed the introduction to the signal and system, and in the previous lecture, we learned about the classification of signals and the difference between some of them.
In the present day, you are going to learn the basic operations of signals, and it is amazing to note how you can play with these signals. The best thing about this series is that you are going to see every step with the help of MATLAB. Let’s have a quick glance at today’s topic, and after that, we will go through a detailed explanation.
Addition of Two Signals
Subtraction of Two Signals
Multiplication of Two Signals
Time Scaling (Compression and Expansion)
Time Shifting (Addition and subtraction)
Reversal of Signal
Moreover, you will also learn some practical applications of some of these operations. All these operations are explained with the help of MATLAB code, and for simplicity, the codes are kept basic so that you may learn more about the concepts.
Keep in mind that a signal has some parameters on the basis of which its graphical representation gets a face. These parameters are
Time
Amplitude
In all the operations, we will deal with these two parameters and change their values in different ways. Recall in mind that the greater the amplitude, the longer a signal goes on the y-axis and more time means that we’ll get wider loops of the signals. Time is an independent quantity and it is always kept on the x=axis no matter what type of signals are you dealing with. In each signal, when working on MATLAB, you will put the time in the first place from the left when using the Stem or Plot function.
We are starting with the easiest operation of the wave. The addition of the signal is the process in which the amplitude of two signals is added and as a result, the signal obtain has the combination amplitude of both of these. The simplest example of this operation is:
x1=sin(2πt)
x2=cos(2πt)
y=x1+x2
The resultant Y has the value of the addition of both these signals. Have a look at the same result on MATLAB for the best graphical representation.
Code |
Output |
t=0:0.01:0.1 f=25; t1=2*pi*f*t; x1=sin(t1); subplot(3,1,1) plot(t,x1) title('x1') grid on; x2=cos(t1) subplot(3,1,2) plot(t,x2) title('x2') y=x1+x2 subplot(3,1,3) plot(t,y) title('y= x1+x2') xlabel('Time/ The Engineering Projects') ylabel('Amplitude') |
|
Keep in mind, this is not the amplitude at which the operation of addition takes place but the values of the amplitude are summed up and MATLAB store these values and show you another wave of this. You can match the values of the result from the workspace window or simply have a look at the wave. Let’s start from the initial point:
y=x1+x2
At point 0
1=0+1
At point 0.01
1=1+0
At point 0.02
-1=0+(-1)
And so on.
Subtraction is also possible in the signals, just like the addition operation. Subtraction between the two signals takes place when the value of the second signal (the one that is written after the subtraction sign) is subtracted from the first signal.
In MATLAB, for simplicity, we are using the same code with the value of subtraction between x1 and x2.
Code |
Output |
t=0:0.01:0.1 f=25; t1=2*pi*f*t; x1=sin(t1); subplot(3,1,1) plot(t,x1) title('x1') ylabel('Amplitude') grid on; x2=cos(t1) subplot(3,1,2) plot(t,x2) title('x2') ylabel('Amplitude') grid on; y=x1-x2 % Here the subtraction takes place subplot(3,1,3) plot(t,y) title('y= x1-x2') xlabel('Time/ The Engineering Projects') ylabel('Amplitude') grid on; |
|
Okay, you must think that this will be the same as the previous two concepts, but no. There is something different from the previous one, but before exploring that, let’s just define the multiplication of the signals:
“The multiplication of two signals is obtained when the values of the amplitude of two signals are multiplied and the resultant signal has the multiplied amplitude.”
Have a look at the MATLAB code.
Code |
Output |
t=0:0.01:0.1 f=25; t1=2*pi*f*t; x1=sin(t1); subplot(3,1,1) stem(t,x1) title('x1') ylabel('Amplitude') grid on; x2=cos(t1) subplot(3,1,2) stem(t,x2) title('x2') ylabel('Amplitude') grid on; y=x1.*x2 % Here the multiplication takes place subplot(3,1,3) stem(t,y) title('y= x1*x2') xlabel('Time/ The Engineering Projects') ylabel('Amplitude') grid on; |
|
If you are new to signals and systems, this is something different that you will learn for the first time. At first, you may think that it is a simple multiplication of signals, but soon you will realize that only one signal is used in this operation, the opposite to the case that we have discussed earlier. Have a look at the definition of this operation:
“The term time scaling refers to the process of multiplying a constant by a signal's time axis. This technique is also known as time scaling of the signal."
Depending on the magnitude of the constant or scaling factor, the time scale of a signal has two possibilities:
Compress
Expansion
These two processes occur depending on the amount of time it takes to complete the signal.
Compression of the signal occurs when the constant number, multiplied by the signal is greater than zero and as a result, a signal is obtained that has a less wide form than the parent signal. It is because the time axis has more values in the resultant signal.
You can say it is the opposite phenomenon of the compression of the signal. In this process, the constant number that is multiplied by the signal is less than zero, and therefore, the gained signal has a wider form.
When data is to be brought in at a certain rate and taken out at a different rate, the time scaling operation of signals is a highly helpful tool to have. It will be more clear when you will observe this example:
Changing the rate at which the signal is sampled is the primary focus of the time scaling technique that we employ. Altering the frequency at which a signal is sampled is one technique that is used in the field of voice processing. A system that is based on a time-scaling algorithm that was built to read text to people who are visually impaired is a specific example of this.
This is another operation on the signal in which the x-axis or time axis changes. Instead of changing the width of the signal, we are shifting the wave to a different location on the x-axis.
“The process of moving a signal forward or backward in time is what the term "time shifting" refers to. To do this, either an additional amount of the shift or subtraction from it is applied to the time variable in the function.”
It is interesting that you are moving the whole signal on the time axis. It has two processes:
This process is used to move the whole signal to the right side of the time axis. The whole signal moves towards the right side and the amplitude does not change.
As you can guess, by subtracting the value on the time axis, you can simply move your signals to the left side of the x-axis no matter where they are at the start.
Code |
Output |
t=0:10; x=[0 1 2 1 0 1 2 0 1 2 1 ]; subplot(3,1,1) plot(t,x) title('Simple Signal') xlabel('Time') ylabel('Amplitude') grid on; axis([-2 8 0 4]); subplot(3,1,2) plot(t+2,x) title('Shifting by addition') xlabel('Time') ylabel('Amplitude') grid on; axis([-2 8 0 4]); subplot(3,1,3) plot(t-2,x) title('Shifting by Subtraction') xlabel('Time/ The Engineering Projects') ylabel('Amplitude') grid on; axis([-2 8 0 4]); |
|
A significant number of signal-processing applications make use of an operation known as time-shifting, which is an essential procedure. For the purpose of performing autocorrelation, for instance, a version of the signal that has been time-delayed is utilized.
When one is first learning about time scaling, one of the most natural questions to ask is, "What happens when the time variable is multiplied by a negative number?" Time travel is the solution to this conundrum. This procedure inverts the time axis, often known as flipping the signal over so that it reads along the y-axis.
“ The process of flipping the whole signal by using the flipping function or by multiplying the whole signal with a negative number is called reversal of the signal because each and every value of signals is reversed”.
This technique is useful in many cases, and the best thing is, that you do not have to change your code much. Just 1 step and you are good to go.
Code |
Output |
t=0:10; x=[0 1 2 3 4 -5 -6 -7 -8 -9 -10]; subplot(3,1,1) stem(t,x) title('Simple Signal') xlabel('Time') ylabel('Amplitude') grid on; y=fliplr(x); subplot(3,1,3) stem(t,y) title('Shifting by addition') xlabel('Time') ylabel('Amplitude') grid on; |
|
There are certain operations on the signals that are too easy to perform but have the ability to change the working of the entire signal. These operations work as the backbone of the signal and system, and once you have command of this, you can work more deeply with the signals. You may also see some other operations in the upcoming tutorial, but for now, you must practice these basic operations and try to make your own signals and play with them. It is an interesting task that must be done on the same day as you learn the basic definition of these signals.
Where To Buy? | ||||
---|---|---|---|---|
No. | Components | Distributor | Link To Buy | |
1 | Raspberry Pi 4 | Amazon | Buy Now |
Thank you for joining us for yet another session of this series on Raspberry Pi programming. In the preceding tutorial, a facial recognition system on a Raspberry Pi 4 was used to develop a smart security system. We also learned how to create a dataset using two Python scripts to train and analyze a series of photographs of a certain person. This tutorial will teach you how to install pi-hole on a Raspberry Pi 4 and use it to block advertisements from anywhere. This is a great initiative for folks who are tired of annoying pop-up adverts while browsing. First, we'll learn how to set up the pi-hole without the need for an environment, then we'll use Docker to install pi-hole, and ultimately we'll see how we can access it from anywhere.
Ads with poor quality are all over the internet, causing havoc with the entire user experience. Various varieties of these intrusive ads are available, ranging from video content that takes control of your browser to ads that infect your computer with malware and steal your private information without your knowledge.
So far, using an ad blocker has shown to be an effective method of preventing advertising of this nature. What if you could have an ad blocker that works on all your local area network devices instead?
Using Pi-hole, an ad-blocking program for the raspberry pi computer, you can block all major advertising networks from loading adverts on your networked devices.
You must first install and configure Pi-hole on your RPi before using it.
DNS server requests are used by all internet services, including adverts, to get you from source to destination. A DNS server translates theengineeringprojects.com into server IP addresses that your web browser can use to connect to the site. As with DNS, ad networks use it to request that their advertising be served.
When you see a Google ad, your internet explorer is likely making requests to domains like theengineeringprojects.com to deliver them appropriately. You have to intercept and prevent these adverts from loading, and that's exactly what Pi-hole does.
You can use Pi-hole to operate as a DNS server for your network. Requests to ad networks are initially routed through Pi-hole, which serves as your Domain name server. Thousands of domains on its blocklist are compared to see if any match these. Ads will be prohibited if the website is blocked, allowing you to have an ad-free experience.
Devices with limited ad-blocking options will find this useful. If you want to avoid adverts on your smart TV or gaming console, you'll need a third-party tool such as Pi-hole to handle the job for you.
Pi-web hole's interface allows you to block or allow specific domains to prohibit strange advertising networks or other questionable sites from loading if you need to tailor the system.
Pi-hole can be installed in two methods on a Raspberry Pi and other Unix distributions such as Debian and Ubuntu. When running a Linux distribution other than rasbian, a single-line command can be used to install it.
Alternatively, you can utilize Docker on the RPi to isolate Pi-hole in a software container. However, Docker requires many configurations, but it does enable you to host pi-hole on a virtual machine.
The fastest approach to get Pi-hole up and running is to utilize the designer's installation script. Running the script via curl or downloading it manually are two options.
Launch a command line and enter:
sudo curl -SSL https://install.pi-hole.net | bash
Before the setup is complete, you can customize Pi settings holes by running the automatic installation script and downloading any necessary packages.
Curling a program from the web is generally terrible practice because you can't preview what the script does before running it, even if it is allowed. You could download your program and then explicitly run it as a last resort.
Obtaining the file is as simple as opening a terminal and typing.
wget -O basic-install.sh https://install.pi-hole.net
sudo bash basic-install.sh
Installing Pi-hole and any other required tools will be completed using the same script used during setup.
Your network connection and chosen logging level will be requested for confirmation at some stage in the installation procedure under the terminal's config choices.
If you don't want to risk losing the randomly created admin passcode displayed at the end of the installation, make a note of that information. If you lose or forget the passcode, you will have to open a command line and run the below to change the password.
sudo pihole -a -p
A Docker container can be used instead of the script supplied above to manage Pi-hole.
Docker is a free software platform for creating containers. With the rise of cloud-native systems, container delivery has gained popularity as a more efficient means of distributing dispersed applications.
It's possible to develop a container without Docker. However, the framework makes the process easier and more secure to do. Docker is a set of tools that make it easy for programmers to create, deploy, operate, upgrade and terminate containers with a single application programming interface and a few basic instructions.
The Unix kernel has inbuilt isolation and virtualization features that make containers practical. Many of the same functionality that a hypervisor provides to allow multiple virtual machines to share a common hardware CPU and memory can also be found in the os.
Since containers provide all the benefits and features of Virtual machines, like software isolation, low-cost scaling, and disposability, they also offer some major new benefits:
Docker provides a shell script that makes it simple to get it up and run.
curl -sSL https://get.docker.com | sh
The following two commands can be used to analyze programs before they are executed:
curl -SSL get.docker.com -o get-docker.sh
sh get-docker.sh
The "permission denied" message will appear if you run several Docker commands, indicating that the root account can only use Docker. For non-root users that want to run Docker commands, the following command will work:
sudo usermod -aG docker pi
It is possible to add users to groups using usermod with -aG. A person called "pi" is now part of a " docker group." This made it possible for pi to perform docker instructions. Any other user can substitute the default pi account.
The command below can be used to confirm this:
groups pi
Check to see if Docker is mentioned as a group.
We will use the hello-world image to see how well Docker works.
docker run hello-world
To tell whether you have installed Docker correctly, you will see "Hello from Docker!"
With the help of Docker-compose, you can create and maintain your environment with YAML files. For applications that require various interconnected services, this is a particularly helpful feature.
To get docker-compose up and running, run pip3 to get it started.
sudo pip3 -v install docker-compose
You'll need to clone the Pi-hole Docker installer from the Pi-hole Git repository to run Pi-hole in a docker container. Let us install Git so that we can get started on this.
Git keeps track of all the modifications you make to scripts, allowing you to roll back to previous versions if necessary. Using Git, many people may merge their contributions into a single source, making it easier for everyone to work together.
You can use Git irrespective of whether or not you develop code that you alone will view or if you are collaborating.
Git program can be executed on a computer's hard drive. You have access to all of your documents and their histories on your computer. Online hosting can also be used to keep a duplicate of the documents and the histories of their modifications. Sharing your modifications and downloading others' updates in a central location makes it easier to collaborate with other programmers. You may even integrate the modifications made by two people working on the same project without losing one another's work, thanks to Git's ability to combine changes automatically.
You may get the software of any os from the Git official site.
Installing Git from the command-line interface is as simple as typing the commands below into your terminal window:
sudo apt-get install git-all
Type in the following command:
git config --global user.name "TheEngineeringProjects"
The quote marks are for your name. The —global parameter specifies that your Git name will be set for all your computer's repositories.
Type the command below to make sure you typed your username accurately when in doubt.
Git config --global user.name
this should return your username:
When pushing code to GitHub, you'll need to provide a valid email address. This can be done in Git.
git config --global user.email "Theengineeringprojects@example.com"
To make sure you've entered your email address correctly, here's a final check:
git config --global user.email Theengineeringprojects@example.com
In a command window, enter the following commands.
git clone https://github.com/pi-hole/docker-pi-hole.git
The pi-hole git repository will be fetched to run Pi-hole in a Virtualized environment. Your container's setup script may be found in the copied Pi-hole directory. You should look over and make any necessary changes to the setup script before executing it.
The program automatically generates an admin passcode for Pi-hole, as are other options like the time - zone Pi-hole utilizes and the standard Domain name server it uses for outbound DNS queries.
./docker_run.sh
Take note of the passcode displayed when the script has been completed successfully. Please note that this passcode is required for further configuration of the Pi-hole.
A reboot of your raspbian should immediately start the service Pi-hole, thanks to its Docker launch script use of the —restart=unless stopped parameter.
However, this only works if you have performed the above steps to activate the container init file to ensure the Docker container is automatically launched upon startup.
Your gadgets should be ready to use Pi-hole now that it has been installed and operating. Default by Pi-hole does not block advertisements in your network. Change your device Domain name server settings to use the Rpi's internet address instead, and they will work.
Each gadget on the local network can be configured for Pi-hole as its Domain name server manually or set up your home network router for Pi-hole instead. To physically configure each device to use Pi-hole, please follow the instructions below.
Your Pi-hole admin interface should begin to show web requests from all devices once configured to utilize the Raspberry Pi's Internet address. Launch an ad-supported application or visit a site like Forbes if you want to ensure Pi-hole is restricting advertisements.
Pi-hole should function properly if the adverts are blocked. In some cases, restarting your devices may be necessary for the Domain name server settings to take effect.
To utilize Pi-hole on many devices within your network, you'll need to configure all of the local network's computers and routers, which is time-consuming and inefficient.
You should use your Rpi's internet address instead of your router's Domain name server settings. As a result, no advertising will be sent to any gadgets on the local area network. By contrast, manually configuring the Domain name server on each device is time-consuming and inconvenient.
To change your Domain name server settings, you will need to know what kind of router you have and what model it is. This information should be displayed on the router or included in the package that came with it.
As a last resort, you might examine your router's guide, use an internet browser, and try out some popular internet protocol addresses.
Internet providers' Domain name servers are typically pre-configured in the router. Ensure the Internet protocol address of the RPi is used as the DNS server.
As a result, all devices connected will be directed to use Pi-hole as the initial gateway for all Domain name server requests. There will be no processing of banned queries, while approved queries will be forwarded to the internet domain name server provider you've selected in your Pi-hole settings.
You may need to reset your router for your new Domain name server configurations to take effect throughout your whole network.
If Pi-hole is up and running, you may log into the administrator site from any internet browser by entering the URL below.
If that doesn't work, it may be necessary to look up your Rpi Pi's internet protocol address if that doesn't work.
Users who haven't logged in to Pi-admin hole's site should be able to see a summary of the service's statistics. Even though Pi-hole is designed to be a "set it and leave it" solution, you will have to make any necessary changes to the settings here.
The Pi-hole administrator site can be accessed by clicking the Login button in the left navigation. Signing in requires you to use the passcode you set up while installing Pi-hole.
If you ever forget the Pi-hole administrative passcode, launch a command prompt or remote SSH connect and use the following command to change the passcode.
sudo pihole -a -p
or
docker exec -it pihole pihole -a -p
When using Docker containers to execute Pi-hole.
You will see all of Pi's features, hole stats, and reports after you have logged in. Pi-hole logs, bans and access control lists, and settings area are all accessible from this left navigation bar.
Most popular advertising networks are blocked by Pi-hole's lists which are frequently updated and managed by individuals and companies.
You can see them by selecting Group Management afterward Adlists in the left menu, where you may deactivate or delete any existing groups, or you can create your own.
Restrict and unblock domains by adding and removing them from the Blacklisted domain list. You can add a DNS server and descriptions to either the Blacklisted or Allowed domains menu by clicking on the Add button.
Select the red delete button symbol next to any entry in the Category of items section below that you want to delete.
If you've got an RPi running Pi-hole, you can utilize it as the Wi-Fi network's domain name server. At home, this is a terrific way to relax. However, you must be at home for this to work. Your Pi-hole must be accessible from any location if you wish to utilize it to prevent advertisements.
Pi-holes in the cloud is the most obvious method of accomplishing this. As long as you don't take further safeguards, malicious actors could exploit your Pi-hole to target other network portions. You also need to subscribe to it and integrate a cloud server. Regardless, we'll go with the low-cost and simple solution of using our RPi with Tailscale.
There is no better way to connect every device safely and conveniently than Tailscale. It gives you the option of selecting a Domain name server.
Tailscale can be used for free in most situations like this by individuals.
the first step is the installation of transport HTTP
sudo apt-get install apt-transport-https
Afterward, include the tailscale sign key and repo in the
curl -fsSL https://pkgs.tailscale.com/stable/raspbian/buster.gpg | sudo apt-key add -
curl -fsSL https://pkgs.tailscale.com/stable/raspbian/buster.list | sudo tee /etc/apt/sources.list.d/tailscale.list
With the code provided below, tailscale is now up and running
sudo apt-get install tailscale
Link your computer to the Tailscale network by authenticating and connecting it there.
sudo tailscale up --accept-dns=false
Pi-upstream hole's servers are Linux-configured Domain name servers, to which it sends DNS requests it cannot answer. Pi-Hole should not attempt to act as its source as it will serve as our Domain name server in this configuration.
Now you're linked up! You can discover your Tailscale Internet protocol address by:
tailscale IP -4
Tailscale's official website has the software you need to get started.
Tailscale's administrator console allows you to set up Domain name servers for your whole network. As a universal name server, provide the Internet address of your RPi's Tailscale as the Domain name server address.
Ensure to use the Override domain Name server option upon entering the Rpi's Tailscale Internet address so that our internet Domain name server will overwrite any local Domain name server settings that endpoints may have.
The security of your network may require that from time to time, you re-authenticate your devices with Tailscale. You'll want to turn off key expiration on the RPi in the administrator dashboard to prevent Domain name server outages when this happens.
That's all there is to it! Whenever you sign in to Tailscale, the Pi-hole will immediately serve as the Domain name server for that machine.
If the Pi-hole is preventing you from accessing whatever you need, you can deactivate it by deactivating Tailscale and reconnecting whenever you're ready.
If something goes wrong, you'll want to be comfortable with the Pi-hole administrator interface, but you won't need to use it regularly. Advertising networks and trackers will be secured and blocked on all or some of your equipment when your gadgets have been configured with Pi-hole in the background.
Because of Docker, you can run multiple programs on the Raspberry Pi simultaneously, providing a 24-hour DNS for you to access. As we've described in earlier chapters, you can use a Rpi network storage or a Rpi VPN to protect your privacy and anonymity online.
A list of well-known ad-serving domains is produced using data obtained from third parties.
Using internet filtering, it is possible to ban adverts in many platforms, such as mobile applications and smart screens.
Your network connection will perform better because advertising is prevented before they load.
Use adblocking software with a VPN service for advertisement blocking and data savings.
You can see the number of ads prevented and a query history on the Graphical interface.
Pi-hole blocks not all advertisements; however, the majority of them are. Pi-hole is a Domain name server with some blocked and allowed features pre-installed. It's not much more than that. Those guidelines determine whether or not a request is granted or refused. To filter advertising that does not use a Domain name server, Pi-hole uses a Domain name server and domain matching. This is a common occurrence in games played on smartphones. Ads are a common feature in many video games. It will not be possible to ban adverts that use the same domains as legitimate traffic. You'll have to put up with the YouTube advertising, even on pi-hole.
With Pi-hole and docker container, we learned how to filter intrusive advertisements from the world wide web. Our datagrams will be accessed more quickly, data loss will be minimized, and cost-effective. Using a raspberry pi 4, we'll develop a voice recognition system in the next chapter.
Hello! Welcome to the engineering projects. This is the second part of the signal and system series in which we will discuss some essential classifications of simple signals. In the previous session, we discussed the introduction of signals and systems and also ran some simple codes on MATLAB for the implementation of some simple codes.
In this session, we are discussing some essential types of signals, and the best part is that we will implement all the signals in MATLAB for the best understanding. Here is a quick glance at all the topics that we will discuss today:
Continuous-Time Signals
Discrete-Time Signals
Periodic Signals
Aperiodic Signals
Even Signals
Odd Signals
Deterministic Signals
Non-Deterministic Signals
Energy Signals
Power Signals
What are functions?
Some examples of signals
Difference between some signals
It is a signal that does not contain any breaks and is referred to as a continuous-time signal.
Differential equations are used to describe this. This signal is represented by the letter x(t). Because of their historical significance, CT signals are frequently referred to as analog signals.
Controlling the speed of a DC motor by the use of a tacho generator's feedback, sine waveforms, or exponential waveforms. The well-known mathematical concepts of differential equations, continuous convolution operators, Laplace transforms, and Fourier transforms are what differentiate linear CT systems from other types.
A signal is said to have a discrete-time signal if its value can be measured at discrete intervals. There will be time intervals of n during which you do not have a value when you are working with a discrete-time signal. The form x[n] is utilized in the representation of DT signals. Continuous-time (CT) signals are approximated by discrete signals.
Difference equations, discrete convolution operators, Z-transforms, and discrete Fourier transforms are some of the mathematical tools that can be used to represent linear DT systems.
Once you have understood these concepts, you must know there are further types of these signals as well. Keep in mind that every signal is continuous or discrete, and these are further divided into sub-types. These sub-types are given next:
A signal is said to be periodic if it satisfies the following equation:
𝑥(𝑛) = 𝑥(𝑛 + 𝑁);
where n is a positive number. In other words, a signal is said to be periodic if it repeats the same sequence of values exactly after a predetermined amount of time, which is referred to as the period.
Sine Wave
Here, we are going to present some lines of code that when entered into the MATLAB window, you will observe a sinusoidal wave.
Code |
|
A=7; f=10000; T=1/f; t=0:T/10:5*T; y1=sin(pi*f*t); plot(t,y1) xlabel('Time') ylabel('Amplitude') title('Periodic Signal') grid on |
|
As we know, all waves have an amplitude, frequency, and time period. Simple code is explained in our previous lecture, but in this code, you must notice that the amplitude and the whole wave repeat their pattern after a particular time period that is exactly the same as in the previous section.
As you can guess from the name, an aperiodic signal is one that can be represented as
𝑥(𝑛) ≠ 𝑥(𝑛 + 𝑁);
Here, n is a positive number.
The signal does not repeat itself after a particular time interval; instead, it has a different pattern at every point.
As you can see in the output, the wave’s pattern is not predictable. You can do the same thing by using a “Random” function that you will see in this same article in just a bit. For now, there is no need to understand all this code, you just have to observe the pattern in the output.
The term "even signal" or "even function" refers to a signal that is symmetrical at the time origin or the vertical axis, respectively. The even signals are also referred to as symmetrical signals for this reason.
Mathematically,
x(-n)=x(n)
In other words, the values on the right-hand side are exactly symmetric to the left-hand side of the axis.
Cosine Wave
A signal is referred to as "odd" if it is anti-symmetrical on the vertical axis. An odd function is another name for an unusual signal. As a result, the signals that are odd are sometimes referred to as antisymmetric signals.
Sine Wave
Code |
Output |
n=-2:12 x=sin(4*pi*n/5) subplot(2,2,1) plot(n,x) title('Odd Signal') xlabel('Time/ The Engineering Projects') ylabel('Amplitude') grid on; xo=-sin(4*pi*n/5) subplot(2,2,2) plot(n,xo) title('Odd Signal') xlabel('Time/ The Engineering Projects') ylabel('Amplitude') grid on; |
Here, in the output, you can see two signals. When we replace the equation with the negative sign, we find that it is flipped and is non-identicle to the first picture. Hence, it is an odd signal.
When there is no room for interpretation regarding a signal's value at any given moment in time, we say that the signal is deterministic. Or, signals are referred to as deterministic when they are capable of being characterized in an accurate manner by a mathematical formula.
Let’s say we have a formula that shows an equation or a signal, then we can predict the result or the graphical representation with the help of that formula, and such signals are referred to as deterministic signals.
sine wave, square wave.
Code |
Output |
n=-2:10 x=sin(4*n/5) subplot(2,2,1) plot(n,x) title('Deterministric Signal') xlabel('Time/ The Engineering Projects') ylabel('Amplitude') grid on; |
|
These are contrary to the one that was discussed before. The result of such signals is not predictable, and therefore, a formula can not be set to represent non-deterministic signals. In one case, they are shown with a certain value, and in the next case, the values change abruptly. Because of the nature of providing random values with these signals, they are also called random signals.
Noise in communication is an example of random signals because no one can exactly predict the noise value during communication.
Code |
Output |
x=rand(1,100); plot(x) title('Random Signal') xlabel('Time/ The Engineering Projects') ylabel('Amplitude') grid on; |
|
Here is an interesting example for beginners. Basically, this code comprises two steps that are used in the functionality of the signal. We have used a function called “Random” and represented as rand(a,b) where a and b are the peak values in between which, this function displays any number randomly without any pattern. In the next step, we will just plot the signal and got the perfect example for the random function.
Energy signals are the ones that contain a finite amount of energy in them. The energy of such signals can be calculated using different techniques, but the power of such signals is infinite. Mathematically,
0 < 𝐸 < ∞
Aperiodic signals
In contrast to energy signals, power signals have a finite power that can be observed and measured, and the energy of these signals is infinite. By using mathematical representation, we can say,
0 < 𝑃 < ∞
Periodic signals
Just like any other programming language, MATLAB also has some pre-defined functions and in this course, we will use some of these according to the need of time. You have observed that some functions are also present in the codes that we have discussed today and now, we are going to discuss some explanations about these functions so that you may have an idea about the working and needs of these functions.
We can write a function independently from the main program, without having to consider how it will interact with the rest of the program as we do so. A function can be thought of as a miniature version of the main program. Because of this, we are able to break down a large program into smaller, more manageable portions, which ultimately results in a reduction in the total complexity of our program.
Flip is an interesting function in MATLAB that can be used to flip the whole signal in just one step. There is no need to write the code with different signs and information. Mathematically, the flip function is given as
B = flip( A, dim )
Where
B= Any variable that is used to store the result of the flip function so that you can take further steps.
A= The signal that is to be flipped. You can also give the signal to any name.
Dim= dimensions at which you want to flip your signal.
We have used this function in our code where we had to find that is our signal even or odd. It is just an example. This function is also used in other codes according to the needs of the programmer.
Random Function is used to have a uniformly distributed random number that is set by the programmer according to need. There are different forms of random functions that are used in random functions and some of them are:
Y = rand(n)
Y = rand(m,n)
Y = rand([m n])
Y = rand(m,n,p,...)
Y = rand([m n p...])
Y = rand(size(A))
Out of which we have used the second one, where we have given the two dimensions to the random function. This returned us an m-by-n matrix of random entries, and we used it for our aperiodic signals.
In the case given above, the result of this random function is stored in the Y variable so that it can be used again for more actions.
While using these signals in our codes, one must be clear about the difference between some same kinds of signals and it is a good practice to have to keep them in mind in the form of points so that you may have the idea about the best use of these signals. Here are some important points to keep in mind.
Continuous-Time Signals |
Discrete-Time Signals |
|
|
|
|
|
|
Periodic Signal |
Aperiodic Signal |
|
|
|
|
Even Signal |
Odd Signal |
|
|
|
|
Deterministitric Signals |
Non-Deterministitric Signals |
|
|
|
|
Energy Signal |
Power Signal |
|
|
Signals have a different type but all of these can be represented as discrete or continuous. We use these types many times while we are dealing with the signal and system and it is important to have the idea of pre-defined functions so that we may minimize the code size with fewer errors.
Signal and systems is an essential subject in electrical engineering and it is not just limited to this particular branch of engineering but students of many other branches such as computer engineering learn and practice this subject in their field. For design and analysis, all engineering topics make use of models of real-world things. Signals and systems provide you with the ability to take on the challenge of getting the job done.
Signal and system are two terms that, when studied and performed together, form a fantastic visualization of different phenomena. Have a look at these two terms.
A signal is defined as the description of comparing two parameters and how they vary with each other. Signals are the representation of some sort of information with the help of some visual aid. Signals are usually categorized into two types:
Analog signals
Digital signals
We’ll go through the introduction of both of these one after the other.
Analog signals are the types of signals that change continuously without any breaks. These signals describe the quantities that have varying values at every point. Therefore, as these signals vary according to time, they are defined over continuous independent variables. Because analog signals have a large amount of information in them, they are comparatively difficult to analyze. At the same time, these signals provide accurate information because the information of every point is stored in them.
Keep in mind, that these infinitely varying signals require infinite memory to store the information of every point on the real line. A sine wave is used to present the analog signal. For a better understanding, we must go through the example of an analog signal.
One of the most understandable examples of analog signals is speech. When humans (or any other animals) speak, there is the formation of continuous waves in the air due to the pressure we exert on the air through our throats. We all know that pressure is an analog quantity and is the mathematical operation with the independent variable of space and time. Other examples of analog signals are:
Time
Temperature
Distance
Sound
The word "digital" means discrete, and therefore, digital signals are defined as discontinuous signals. These are less accurate signals because they do not have all the information stored continuously in them. In digital signals, there are only two variables on which the whole system depends. These are 0 and 1. In return, the results are then also represented in the form of these two variables. These are easy to analyze and require a finite amount of memory to store the information.
The Digital Watch is one of the easiest examples through which you can understand the concept of a digital signal. We can have the values of the hours, minutes, and seconds but not have the values in between the seconds. Keep in mind, that there is an infinite number of values even between the seconds that can not be accurately obtained with the help of the digital system.
Any physical collection of components that can both receive and produce a signal is referred to as a system. When speaking in terms of engineering, the input is typically some type of electrical signal X, and the output is typically another electrical signal (the response). Example of System
A system is anything that contains the components that act on the input signal, and after the procedures, the output is obtained on the other end. For example, a system of different procedures is made to remove the noise from the voice. At end A, the voice with the noise is fed into the system, different procedures occur on it and at end B, a pure voice is obtained without noise.
Another example is the system of images in which the pixels of the images are sharpened by using different techniques, and at the output, we get a sharpened image. Other examples of systems are given as:
A communication system is a system that outlines the process of exchanging information between two different locations.
A control system is a system that governs the output to achieve the appropriate reaction. Control systems can also be referred to as command and control systems.
The auditory system in the central nervous system is responsible for converting a diverse range of relatively modest mechanical impulses into a convoluted series of electrical signals.
The concepts of analog and digital signal processing, which are at the core of contemporary communication and measurement, are discussed in Signals and Systems. In this section, we will discuss the fundamental ideas behind signals with continuous-time and discrete-time in the time and frequency domains. The Fourier transform establishes a connection between time and frequency.
If all of these are confusing at the moment, then do not worry, because we are going to discuss all the concepts used in signals and systems in detail without skipping any points. The good thing is that we’ll be using practical techniques to implement the rules of this subject in different engineering software, mainly MATLAB.
We have read about the types of signals, but here, it is important to discover some important differences between these two types of signals so that you may choose the best one for your experimentation according to the requirements.
Element |
Analog |
Digital |
Representation |
Continuous |
Discontinuous |
Analysis |
Difficult |
Easy |
Accuracy |
More Accurate |
Less accurate |
Type of memory |
Infinite |
Finite |
Digits for representation |
Infinite |
0,1 |
Example |
Human Voice, Pressure, Analog Clock |
Digital watches, Digital phones, Digital pens |
MATLAB is a complex calculation software used in many branches of science, especially in the field of engineering, for many purposes. It is made by a company named Mathworks and has fantastic functions and usage that provide a powerful practice medium for engineers. It has numerous applications and is divided into different sections that can be programmed. Basically, MATLAB is a programming language, and for this course, you just have to keep in mind that we’ll define the signals, build the system, provide all the given information, and use different functions on signals to obtain the required results.
We’ll use MATLAB R2016a in this series.
This is a high-level matrix and array language that supports
Object-oriented programming
Flow control statements
Functions
Data structures
Input/output
and many other languages. It enables "programming in the tiny," which allows for the rapid creation of quick throwaway programs, as well as "programming in the huge," which enables the creation of complete large and complicated application applications.
Basic knowledge of computer programming.
Basic concepts of variables, constants, expressions, statements, and some others.
Mathworks free account.
Operating System |
Windows 10,11, Window Server 2019 |
Processor Requirement (Minimum) |
Any Intel or AMD x86-64 processor |
RAM (Minimum) |
4 GB (8 GB is recommended). |
3.6 GB ( MATLAB) 5-8 GB (Typical installation) 31.5 GB (product installation) An SSD (Strongly recommended) |
Creating a Mathworks account is super easy. You just have to provide and confirm your email address and set the password.
If you are a beginner at MATLAB, then you must know the components of the main screen of MATLAB and the workings of each window. Let’s have a picture of the screen of MATLAB, and all the things will be clear to you in just a bit.
The command window, which also goes by the name main window, has the job of carrying out the instructions that users type into it.
This is the list of folders that are present in your computer’s specific folders, and for our tutorial, you do not have to know much about it at this stage.
You can pick one of the different functions from this menu, and in this tutorial, you are going to choose the Live Script for the easiest functioning from the drop-down menu.
When variables are initiated in the code, the values of each of them are shown in this window.
This sign indicates the line of the code where you are writing at every step.
Here, we are discussing some important and simple commands that may or may not be used in every code according to the voice of the user. But for professional users, it is a good practice to use them as they make the result clear.
This command creates a grid in the resulting window so that you may have the best idea of the scale of your restaurant signal.
As the name specifies, this creates a title for the result and you have to write the string (which you want in the place of the title) in the single comma notation close to the parentheses just after writing this command.
Just like the title, you have to write the string that should appear on the x-axis of your singal by using this command.
This command is used to provide a string message on the y-axis.
Here comes the exciting part. We are going to make simple signals in MATLAB so that all the concepts given above will be clear at once.
Start your MATLAB software.
For best results, it is convenient to work on the live script because, in this way, you are going to check the code at every step and examine the result in the same window.
Write the code given below on the command window:
A=5;
f=5000;
T=1/f;
t=0:T/100:5*T;
y1=sin(2*pi*f*t);
plot(t,y1)
xlabel('Time')
ylabel('Amplitude')
title('Continuous Time Sine Wave')
grid on
We have specified the variables A, f, T,t,y1, and the details of each of them is:
A= Amplitude of the sin wave
f=frequency of the wave
T= Specifying that period is inverse of frequency
t = the time of starting, number of steps, and ending of the wave.
y1 = name of the wave in which we have given the formula of the wave that we want to display.
By using all these variables and formulas, we told MATLAB that we wanted a wave of this size to have this specific type of wave.
The plot is the function of plotting the continuous waves. We have specified that we want a wave by using the time on the x-axis and the y1 formula of the wave on the y-axis. In general, the formula is plot(x,y).
Right now, just copy and paste this code into your live script and observe the results.
x=[1 2 3 4 5 6 7 8];
n=[0 1 2 3 4 5 6 7];
stem(n,x)
xlabel('Time')
ylabel('Amplitude')
title('Discrete Time Wave')
grid on
As mentioned for the analog signals, we have just made two types of waves, where x is the value of the wave at the x-axis and n is the value of the wave at the y-axis. At every step, we have used the function of stem and specified the values where
stem(x,y)
The number of values on the x-axis must be equal to the number of components on the y-axis.
Analog does not equal continuous, and digital does not equal discrete. On the other hand, in popular usage in the context of digital signal processing, analog systems are typically continuous in time and value, whereas digital systems are typically discrete in both time and value. Therefore, there is some improper use of the language.