Subroutine in Ladder Logic Programming

Hello friends, after completing that basic part of ladder logic programming, let us today go through one topic which is not essential to know to complete a PLC ladder program but it is important t have our code readable program and reusable pieces of code. That could happen by using what so-called a subroutine. So what is a subroutine?

Well, it is a piece of code that includes a few rungs to perform specific tasks. that piece of code can be reused numerous times through the program when we need to call it for performing that task. That subroutine enables us to structure our code like building blocks so that the program will be readable very easy and also reusable later in other projects. The idea of dividing the program into routines to apply the divide and conquer technique is very crucial to ease the coding of your program especially when it comes to the large-scale program which is the common cause in the best industry practice.

Each routine achieves one specific task and they are integrated to accomplish the whole mission. By programming in that way, the code is more readable and reusable meaning that one routine could be called many times instead of keeping repeating the lines of code or ladder rungs everywhere we need it. In this tutorial, we are going to be very familiar with subroutine-based programming including different ways to call a subroutine and the instructions that are used for handling subroutines. And yes we are going to practice examples that program that subroutines in ladder logic so let's get started.

Types of routines 

Routines can be classified into two main types: the calling routines that call subroutines. And routines that are being called. Figure 1 shows the very typical scenario of calling one subroutine. It shows the scenario when the calling routine reaches the calling instruction when the subroutine is being called with the value of the parameter passed by the calling routine and then the subroutine has a return instruction to take the execution to the following instruction of the calling instruction.  So you can imagine the calling instruction is in the calling routine which is mostly the main program and the called subroutine is responsible to return the control or the execution point to the instruction next to the calling instruction.

Passing parameters 

There are two main ways for passing parameters between the calling routine and the subroutine that is being called. The two ways are calling by value and calling by reference. In the calling by value method, the calling routine passes a copy of the original parameters so the called subroutine works on a copy. Therefore, there are no changes could happen to the original parameters in the calling routine. In contrast, in the second method which is called call by reference, the parameters are shareable between the calling routine and the subroutine that is being called. So, changes happened to the parameters but the called subroutine reflected on the original ones. Figure 2 depicts a case scenario of the two types of passing parameters. In that very example, the main routine calls subroutine “Call_Val” to apply an increment of operand “Op1” passing the parameter Op1 using the method “calling by value” while it calls “Call_ref” to do the same process but in that case, it passes parameter Op1 by using the method of “calling by reference”. As you can see, in the case it uses the “calling by value” method, it does not change the value of parameter Op1 because it uses a copy of the parameter and increments that copy not the original parameters. On the other hand, when it has used the other method, “calling by reference”, to increment the same parameter Op1, it does change the original operand because it uses a reference that points to the original parameter address. In another word, calling a subroutine based on a call by value works on a copy of the parameters and does not change the original variables while calling by reference works on the originally passed parameters so it does change the parameters. The advantage of calling by reference is saving the memory as it does not need an instance of the variables or a separate data block. On the other hand, calling by value needs to have a separate data block to include that copy of passing parameters. However, it can be called many times with a separate copy without any conflicts.

Program sequence:

Figure 3 shows the program sequence when using multilevel branching using subroutines. For example, the main module keeps carrying out the network net1, and net2, and it calls the subroutine “Sub x” in-network net3. Then subroutine “sub x ” starts executing from network net1 to net3 at which, it calls subroutine “Sub y”. Then subroutine “Sub y” carries out starting from the network “net 1”, and network “net 2” calls subroutine “Sub a”. You can notice subroutine “Sub a” returns to the calling routine “Sub y” which returns to subroutine to its calling routine “Sub x” which returns to its calling routine which is the main routine. So, you can notice how many levels of subroutine calls? Yes, they are a lot. But, it is recommended to be as much as needed for two reasons. First, many branching causes some headaches in processing in terms of memory and time. Memory is represented in the data block that is needed for each subroutine every single branching or subroutine calling and time is represented in extra instructions of calling and returning and stacking data related to the called routine and the returning addresses.

Subroutine instructions

There are two main instructions used for calling a subroutine and returning to the calling routine. Figure 4 shows the network rung that calls a subroutine called “Auto Mode”. It is going to call the subroutine at any time when the “System OK” memory contact MB180 is true. So I hope you can feel now how your program is more organized and readable when you go through the main program and easily can catch what the program does by reading the names of the called subroutines. Exactly, having a meaningful name for subroutines is very important to give the advantage of the readability of your program. So, my friends please make sure you chose a purposeful name for your subroutines.

Also fig. 5 shows the network rung that represents the returning command to the calling routine. It shows when the alarm is true represented by memory contact MB32 and pump status “Stop Pump” represented by memory bit64, the return command will be enabled for returning the execution point to the network just next to the calling network in the calling program. For example, if the calling network is at rung number 3, then the return command in the subroutine will return the execution at rung number 4 in the calling routine.  By the way, in most cases of ladder logic programming, you might not find a return instruction because it is inherently performed by completing the called subroutine but we just include it here as in fig. 5 to show up how the process of calling a subroutine and returning to the calling routine.

Figure 6 depicts the whole image of the scenario of calling one subroutine. In rung 3, a subroutine called “Auto mode” is being called by having the memory contact MB18 true. Then after that subroutine, “Auto mode” is completed it returns to the calling routine at the next rung to the calling rung which is in this case example rung number 4.  As we stated earlier, you can notice that there are now returning instructions but automatically, the called subroutine returns to the calling routine at the instruction just next to the calling instruction.

Practicing Subroutine in ladder logic

My friends, let us go to our lab as usual and do some hands-on practicing subroutine using the simulator. But before going further in practice subroutine we want to elaborate on the different types of subroutines in Siemens programming. Table 1 compares the subroutine implementation based on function and function block. It shows that subroutine can be implemented by either function FC or function block FB. And both ways can use input, output, and in-out parameters. 

FC does not use static data or data block (DB) while FB uses DB and passing parameters by making an instance of the variables which is calling by value. FC passes the parameter by pointing to the address of the variable which calling by reference technique.   

Table 1: Comparison between FC and FB subroutine in Siemens

Characteristic

FC

FB

Can be used as a subroutine

Yes

Yes

Can use parameters for Inputs, Outputs, and Input

Yes

Yes

Can use temporary variables

Yes

Yes

Can use static variables (with remanence)

No

Yes

Need an auxiliary (instance) DB for each call

No

Yes

Parameters are passed as the address for internal use

Yes

No

Parameters are copied to/from a DB (instance) for internal use

No

Yes

Can call internally a FB or FC

Yes

Yes

Can be called for a FB or FC

Yes

Yes

Can call a FB as multi-instance

No

Yes

Can be called without filling all parameters

No

Yes

Subroutine in ladder logic programming 

Again, there are two ways of calling a subroutine in Siemens ladder programming as shown in fig. 7. We have developed a sample ladder program that calls a simple subroutine to add two input operands. In the first rung, it uses function “FC1” called “fun_A” and in the second rung, it utilizes a function block FB1 called “FB_A” as you can notice function block uses a data block instance for passing a copy of the operands while function FC does not use a data block and uses the address of the input and output parameters.

Figure 8 shows the function block FB_A. the function block has two input operands which are “op1” and ‘’op2” and one output operand which is “sum”.

Because the function block passes parameters as copies or instances, fig. 9 shows the related data block DB1 which contains the parameters of the function block. It is composed of many structures for holding input, output, input, and static data as well.

On the other hand, the function uses the addresses of the parameters. Therefore, it does not need a data block as shown in fig. 10. It uses many structures to pass input, output, input, temporary, and constant data types.

Simulation work

Now let’s check the work with the simulator. Figure 11 shows the results of simulating the calling subroutine based on function FC_A that adds two static operands showing the calling path from the main organization block to the function.

On the other hand, calling a subroutine based on a function block uses an instance of parameters in a data block as shown in fig. 12. This means another instance of data is used every time we called that subroutine while using the function it is referencing the same variables at the same addresses. 

What’s next

Thank you guys for following me up to this very point of our tutorial and being very confident by knowing the subroutine you now are all set to write an organized program and readable and reusable piece of code using ladder logic programming. the next time we are going to talk about one of the most important topics in PLC programming which is master reset control showing what is it about and its importance for PLC and control project and for sure will practice with our simulator lab. So be ready and let’s meet in the next tutorial to enjoy learning and practice the PLC ladder programming series.

Master Reset Control in Ladder Logic Programming

Introduction 

Hello friends, I hope you are doing very well. Today we are going to learn and practice the master control reset (MCR)! So what is that MCR? Well! This is a tool you might use to control a group of devices with one push button for performing fast emergency responses with one click for a group of devices in one zone. In another word, you divide the program into zones and put this zone between a master control to control their operation as one unit by one contact. This technique is useful for applying emergence stops and also protecting some equipment by applying a safety restriction to not operate when that condition is in effect. 

The concept of the master control reset (MCR)

Figure 1 shows the master control relay in a ladder logic showing a couple of rungs between the master control and master control reset to be controlled as one zone by master control. for example, input 1 enables the master control relay M100 which is the only way to relay the hotline of power to rungs 2 and 3 as shown in the figure. When input 1 is on, the master control relay is energized. Therefore, input 2 and input 3 can energize output 1 and output 2 respectively. But, if input 1 is off, the master control relay is off. Therefore, rungs 2 and 3 are disconnected from the power. Therefore, even if input 2 and input 3 are on, outputs 1 and 2 will not energize because of a missing connection to power via master control relay M100. To sum up, there is a zone that contains a couple of rungs, these rungs are not enabled without master control enabled. Also, fig. 1 shows the structure of the master control and master control reset to have one rung to enable the master control relay and one rung at the end to represent the master control reset and declare the end of the zone that is under master control. and the code or rungs that are located between the master control and the master control reset is the zone that we need to control its running based on master control. So, if the master control is not true, the code in that zone between the master control and the master control reset will be bypassed and the next instruction after the master control reset instruction will be executed. 

The concept looks very simple but it is crucial for safety and control techniques. Also, many master control and zones can have in our program as shown in fig. 2. It shows more than one zone and each one is controlled by its master control.

So we want to go further in demonstrating the master control reset by a practical example from real life. Figure 3 shows a practical example of real-life in the industry of which automatic bottle filling process. So what does master control have to do with such a process? Will! That is a good question because it tells me you understand master control reset and are with me on the same page. So, as you can see, there is the start and stop pushbuttons and we need to use master control to control starting and stopping the whole process regardless of the status of individual inputs and sensors. by having such control, we can stop the process in any emergency case or for doing maintenance. The sequence of the process is to start moving the conveyor by hitting the start push button. The conveyor keeps running until the proximity sensor comes ON. At that time, the valve will open for 5 seconds and then the conveyor continue moving again after 5 seconds and continue for 3 bottles repeating the same process. But if there is an emergency happens, there should be a way to stop the process including moving the conveyor, and opening the valve even if all conditions to do are met. Well done! You are correct, master control and master control reset should bracket the process to be enabled and disabled when that emergency comes to happen.

Master control in ladder logic

Master control and master control reset are the same concepts. However, a few differences you can notice in ladder logic from one plc brand to another. For example, Fig. 4 shows the ladder logic code of a master control reset in Mitsubishi PLC. You can notice the same concept has been applied. A zone of a couple of rungs is surrounded by master control and master control reset instructions based on master control relay M100. Input 1, X400 enables the master control relay M100. And rungs 2 and 3 are included in the zone under master control.

On the other hand, master control and master control reset look a little bit different in Allen-Bradley as shown in fig.5. However, you can notice the same concept is applied by having the zone that includes a couple of rungs between the master control relay and master control reset for enabling or disabling that zone based on the logic and situation.

Also, Siemens shows a few differences in ladder logic of master control as shown in Fig.6. however, the same concept is thereby enclosing the code to be controlled in a zone preceded by enabling to master control relay and followed by a master control reset to clear that master control and show the end of the controlled zone.

Practice Ladder logic example

Guys, it is now the time to enter our lab and enjoy practicing the master control and master control reset by using our simulator as usual for validating our understanding of what we have gone through in this tutorial on ladder logic programming. In the example simulated below and shown in fig. 7, we have designed simple master control and master control rest to have master control of running of Q0.0. you can notice that, despite input I0.1 being true, Q0.0 is not energized because master control is not enabled or in off status. So what happens if we enable master control by switching on input I0.0?

Yes, you are correct! The output Q0.0 will now work after enabling the master control by turning input I0.0 on as shown in Fig.8.

What’s next???

Let me thank you guys for following up until this point and because your knowledge of ladder logging is getting increase every single tutorial, I would like to announce that, the next tutorial will be about one of the very advanced levels of ladder logic programming which is for expert and I thought you are now. The sequencer output instruction in ladder logic is our topic for the next tutorial in which we will learn and practice how to, massively output data sequentially to outputs. Please do not worry if that is not clear for now and just be there to go through it step by step and enjoy practicing one topic for an expert ladder programmer.

Properties of z-Transform in MATLAB

Hello, readers. Welcome to another lecture on signals and systems where, on the previous day, we studied the transforms. A Z transform is used to change the domain of a signal or function. It is used to convert the signal from the time domain into the z plane. Now we are going a little deep into the discussion. Have a quick promo of the topic of today:

  • What are the properties of z transform?

  • What is the unit impulse of z transform?

  • What is the unit ramp of z transform?

  • What is the difference equation and how is it related to the z transform?

  • What are some important applications of z transform?

We’ll go through each of these topics in detail, so stay with us to learn about all of them.

Properties of z Transform

Till now, we have seen the introduction of z transform along with some basic information. It's time to discuss some properties of z transform in this lecture. We always mention the properties of the topic if possible to clearly describe the nature and workings of that particular topic. It will be correct to say that while discussing the properties of a mathematical tool, we provide you with a wide domain of learning and experimenting about that particular topic. 

Linearity of the z transform

The z transform is always linear. It means, if we have two statements and apply the z transform individually on both of them, then we always get the linear results. Mathematically,

If

 F(z) = Z{fn}

and 

G(z) = Z{gn}

Then

Z{afn + bgn} = aF(z) + bG(z)

Time Shifting Property

When we talk about the time shifting property of z transform, we come to know that while passing through the time shifting process while we are performing the z transform, we get the following results:

 x(n)⟷Z.TX(Z)

If we take n-m instead of n in the property given above, we’ll find the results in which the signal in the z plane multiplies with the z complex number having the exponential power equal to the m with a negative sign with it. 

Time Reversal Property of z Transform

The time reversal property of z transform states that if we have the following condition:

x(n)⟷Z.TX(Z)x(n)⟷Z.TX(Z)

Then after applying the z transform, we will get

x(−n)⟷Z.TX(1/Z)

You can see that after the application of z transform, we get the z in that is present in the denominator of the resultant X value. Therefore, this property is named the reversal property.

Convolution of z Transform

Convolution is an important process in signals and systems and we have also read great detail about it in this course. While merging the concept of convolution and z transform, we get to know that if, 

x(n)⟷Z.TX(Z)x(n)⟷Z.TX(Z)

and 

y(n)⟷Z.TY(Z)y(n)⟷Z.TY(Z)

Then we can easily guess that 

x(n)∗y(n)⟷Z.TX(Z).Y(Z)x(n)∗y(n)⟷Z.TX(Z).Y(Z)

Keep in mind, the convolution is not same as the multiplication of the signal. It is the process in which two signals are overlapped in such a way that they form the third signal that has a mix of the properties of both the signals that are convoluted. 

Corelation of z Transform

If you have studies about the convolution, you will surely have the information of correlation as well. This property of z transform states that if we have 

x(n)⟷Z.TX(Z)x(n)⟷Z.TX(Z)

and 

y(n)⟷Z.TY(Z)

Then after the process of correlation while you are using z transform, you will get the following results:

x(n)⊗y(n)⟷Z.TX(Z).Y(Z−1)

If you are new to the correlation then you must gpo to our previous lecture about correlation where we have descried this briefly. 

Initial Value Theorem

Based on different experiments and studies, a theorem has been introduced and the initial theorem is one of them. This theorem is used to find the initial value of of the statement without using the inverse z transform and it states that:

x(0)=limz→∞X(z)

This theorem is only applicable to casual signals. 

Final Value Theorem

This is another theorem that is usually introduced while discussing the initial value theorem. It states that if:

x(∞)=limz→1[z−1]X(z)

It is also used in cases where you do not want to apply the inverse z transform and use the alternative way.

Z Transform of Unit Impulse Function

The unit impulse function is used in physics and mathematics. It indicates the function that has zero width and a unit area that is the area of value 1. Unit step function using z transform is simple and easy and it results in the sequential series. Suppose we have the following function:

Then after applying the z transform of this statement, we get a geometric series. Recall that geometric series is the one in which every value is the result of the multiplication of the previous value with a particular constant depending upon the condition given for the geometric constant. 

Z transform and Unit Ramp Signal

A unit ramp function is one that after the implementation of different operations, provides a graph that has a straight slope. Such functions are widely used in the formation of complex operations. While using the z transform, it is defined as:

x(n)=r(n)={n For n≥0 0 For n<0 }

Then we can solve this by using the procedure of z transform as:

Multiplication Property of z Transform

The multiplicative property of z transform is also called the complex convolution property of z transform. It is because, it results by the multiplication of two signals of time domain that corresponds to the complex number of z domain. You can have the idea of this property with the help of the code given nex that is the extension of the code that we have worked with before. 


Code

Output 

syms n;

f=sin(2*n)

F=ztrans(f)

G=iztrans(F)

H=F*G

Z Transform and Difference Equation

The difference equation is somehow a special case in the equation and the z transform is used to solve this in an effective way. It is defined as:

“The difference equation is the special type of equation in which there exists a difference (minus operation) of different variables. These show the relationship between an independent variable and the consecutive difference of a dependent variable.

These are not complex equations, and usually they depend upon arithmetic operations. Here is a simple example of the difference equation:

y(n)− 34y(n−1)+y(n−2)=x(n)+x(n−3)

Another example of the difference equation is:

𝒚-(𝒏+𝟐)−𝟔𝒚-(𝒏+𝟏)+𝟗𝒚-𝒏=𝟐^𝒏

There are certain steps that are used to solve the difference equation, and these are given next:

  • Convert the difference equation into the algebraic equation using the specific procedure of the z transform. 

  • Calculate the solution of the resultant equation in the z domain. 

  • Take the time domain equation of the result by using the inverse z transform (that we learned in the previous lecture).

Difference Equation in MATLAB


Code

Output

fs=1000;

t=0:1/fs:1

f=2;

x=cos(2*pi*f*t)

n=-0.1+(0.1*0.1)*rand(1,length(x))

nx=n+x;

num=[1 0.3 1/3]

den=[1]

y=filter(num,den,x);

plot(t,y)


Here, you can see that we have used the plot command to see the signal graphically. You can skip it if you want to have the numerical values only. By changing the frequency value, you can have different types of results. Other parameters that qwe have used are the same that we have described in the previous sections of this series. 

Applications of z Transform

Z transform has great significance in the mathematical field, especially in the signal and system and other branches where the signals have a fundamental role. Till now, we have learned a lot of things about this transform and therefore, we expect that you will understand the reason why this transform is used in almost every field of mathematics. 

Analysis of Digital Filters

As we have said earlier, z transform deals with discrete-time signals. This is the main reason z transform is used in the process of digital filter analysis. The interesting fact is, laplace transform can not be used in this regard because they can not work on the discrete signals. 

The digital filters are the mathematical algorithms that are mainly used in the implemetnatation of digital input signals to obtain the digital output signals.

Analysis of Linear Discrete System

One of the property that we have learned till now is the linearity of z transform and this property is also used in the analysis process of linear discrete system. The are the system that takes the discrete system as input and after different operations, it also restun us the discrete signals again. Z transform is used to maintain the stability of the result throughout the system.

Frequency Response

We all know that the z transform is used to obtain the result in the z plane. It converts the signal with the time domain into other formats, such as the frequency domain. Therefore, while working with the signals, the z transform is used in finding the frequency response. 

Telecommunication

In the field of telecommunication, all systems are based upon the transfer of a number of bits from one place to another. Z transform is used there to stabilize the flow of the bits as they are in the form of discrete signals. Other techniques are also useful for the same purpose, but while using the z transform, it becomes easy to predict the results and the time at which the communication will occur. 

Feedback Control Problems

A Z transform is used to overcome the feedback control problems of the system. It is done by using different types of signals, including continuous time and discrete time signals. This transform can be used differently when practically implemented.

Identification of the Signals

In operations where experts want to know the exponentially changing values of the signals, they prefer to work with the z transform according to the nature of the signal.

Usage of complex number z in z transform

As we have learned previously, there is a z value that is used in the work of z transform. This is an important feature of the z transform because of its complex nature. It is used to perform complex calculations easily, which were not possible with the Laplace transform.

Signal Processing

Z transform is widely used in signal processing ( as we are reading it from the start). Basically, it is a signal processing tool that is efficiently used in the analysis and interaction of different signals. The poles and zeros used in this type of transform help to recognize the nature of the signal; that is, is it casual, stable, or inverse in nature?

It was a long article based upon interesting facts about the z transform. We were having the discussion of the z transform from our previous session where we saw the basics of the z transform. We saw the properties of the z transform and discussed the important points to clarify our concepts. We also use MATLAB for the implementation of a difference equation. In the end, we learned the simple description of the z transforms application to make our minds about the importance of this topic. If you want to learn more, you can find examples of each property and Use them as your homework. The next lecture is also going to be a little bit complex yet interesting because we are going to learn another transform, which is the Fourier transform.

Introduction to Z Transform in Signal and Systems with MATLAB

Hey learners! Welcome to another exciting lecture in this series of signals and systems. We are learning about the transform in signals and systems, and in the previous lectures, we have seen a bulk of information about the Laplace transform. If you know the previous concepts of signal and system, then this lecture will be super easy for you to learn, but if your concepts are not clear, do not worry because we will revise all the basic information from scratch for our new readers. So, without wasting time, have a look at the topics of today.

  1. What is z transform? 

  2. What is the region of convergence of z transform?

  3. What are some of the important properties of the region of convergence?

  4. How to solve the z transform?

  5. What is an example of the z transform in MATLAB?

  6. What are the methods for the inverse z transform?

What is z transform?

You must have an idea that the Laplace transform is a general case transform and converts the signal from a time domain into a frequency domain. The same is the case with the z transform, it changes the domain of the signal but in another way. The Laplace transform is associated with the power signal and the z transform has some other characteristics. Usually, the z transform is used to understand the stability of the system. Z transforms are used in

  • Energy signals

  • Power signals

  • Neither power nor energy signals

Yet it is applicable to a certain level, and after that level, it is not that much more effective. The Z transform is a powerful mathematical tool and is widely used in mathematical courses and applications including signals and systems. We introduce the z transform as:

"The Z transform is a mathematical tool that, after different procedures, converts the differential equation (with time domain) into the algebraic equation of the z domain."

Mathematically, we show it as:

As you can see clearly, the summation sign contains the limits from negative infinity to positive infinity which means it is a bilateral function of the z transform that we have shared with you. 

By the same token, you can also predict that the z transform also has another region that lies between the zero to positive infinity. It is called the unilateral z transform and it works a little bit differently than the first case discussed here. We describe it as:

Let’s discuss the whole statement in detail but prior to starting, recall in your mind the definition of discrete-time signals. We know that:

“A discrete-time signal is one whose value can be measured at discrete intervals." When working with a discrete-time signal, there will be time intervals of n during which you will not have a value. In the representation of DT signals, the form x[n] is used. Discrete signals approximate continuous-time (CT) signals."

Therefore, when talking about the z transform, keep the definition of z transform in your mind to understand what exactly is going on. 

Now, look at the statement given above.

  • We have the discrete-time signal in the time domain represented by x[t]. 

  • We applied the z transform to it. 

  • Now, we got the same signal that lies in the z domain and is multiplied with a complex number z having the exponential of the n with a negative sign. 

  • Do not worry about the value of n all the time. The summation sign indicates that the value of n starts from negative infinity (or zero in unilateral z transform) to positive infinity, and in this way, we found the values of the series. (This will be much clearer when we discuss the procedure).

    Here z is a complex number that is described with the help of this equation:

    At this level, there is no need to describe the basic concepts of complex numbers. In general, we can summarize the above discussion through the statement given next:

    x(n)⟷X(Z)

    The whole discrete time signal is converted into another format with the z transform as a base,

    Region of Convergence of z Transform

    The region of convergence, or simply ROC, is an important term that is used to describe the range of z in the z transform. As we have said, z is a complex number and its range, therefore, has different types of properties. 

    Properties of the Region of Convergence

    • No. of poles: In z transform, where x[z] is always finite, there are no poles. (We’ll define them in a later section). The ROC of the z transform does not contain any poles. 

    • When talking about a right-sided signal, the region of convergence is always outside the z-plane circle.

    Where the shaded area is ROC.


    • When talking about a left-sided signal, the region of convergence is always inside the z-plane circle.

    Where the shaded area is ROC.

    • If we have the signal on both sides, then the region of ROC is in the form of a ring inside the circle. 

    • To have a stable form, the region of convergence has a unit value.

    Procedure to Solve z Transform

    There are different cases in the z transform that if we start to describe, will be more confusing and time taking than other transforms. So, we’ll discuss a general format of z transform, and after practice, you will learn the procedure effectively. 

    Thoroughly examine the question. 

    Use the formula of the z transform given above.

    • Put z into the denominator as it has negative power. Doing so will convert the negative power into a positive. 

    • Make sure you take the common values out of the sequence. 

    • Put the value of n as 0, 1, 2, 3, 4, and so on to get the series. 

    • Solve the equation.

    It is the most basic and simple description, but the z transform is not that simple. Instead of solving the long calculations, why not use MATLAB for practical implementation? If you have your own course instructor at university, you must have the idea of solving the procedure by hand. 

    Z transform in MATLAB

    In MATLAB, the z transform is as simple as the previous transform was. Therefore, we are emphasizing the usage of MATLAB at every step. Note that if you want to have a detailed procedure to perform the functions theoretically, you can find your instructors. But from the performance point of view, you should go to MATLAB to confirm your answers all the time. Here is a simple example of an equation that also shows some little details. 

    Code:

    syms n;

    f=(2*n+5)/3

    disp('x[n]=')

    disp(f)

    ans=ztrans(f)

    disp('z[n]')

    disp(F)


    Output:

    Here, you can see we have used the pre-defined function of z transform given as:

    ztrans(x)

    With the help of the z transform, you can solve any equation or expression that you want. 

    Notice that we have used a display function in the code. You must know that z transform can also be done in MATLAB without using the function. 

    Display function in MATLAB

    The display function is used to label the numerical output. It does the same work as the xlabel and ylabel in the graphical window of MATLAB. Moreover, this function is also used to call the value that we have specified before using it and to display the results directly. The syntax of the display function is

    1. disp(x)

    2. disp(‘x’)

    Where,

    • To display the string value, we use inverted commas around the value. 

    • To call the value of x, we simply use it as it is. 

    • Never use this function with a capital D or any other change in the spelling, otherwise, you will get the error. 

    Have a look at another example of the z transform in which we added two trigonometric functions and found their z transform.

    Code:

    syms n;

    f=sin(2*n)

    ans=ztrans(f)

    g=cos(3*3.14*n)

    ans=ztrans(g)

    Output:

    Zaros and poles of z transform

    When you study this particular topic of z transform, you will hear some terms named as zeros and poles. These are the simple topics while learning z transform and usually, are used in the numerical problem. Consider the following equation:

    Zeros: while solving the equation with the fraction, the numerator contains the M roots corresponding to the zeros. In the equation given above, q represents the zeros.

    Poles: When you are solving the fractional equation by z transform, the N roots in the denominator are called the poles. Here, these are represented with the letter p.

    While solving the z transform, we make a circular representation to solve the equation, just like we did while we were learning ROC. Poles are represented at the y-axis, and zeros are represented at the x-axis.

    Inverse z Transform

    As you can guess from the name, the inverse z transform is used to convert the results of the z transform into the form before the z transform. There are different methods through which the calculations of the z transform are inverted from an equation. 

    1. Long division 

    2. The partial fraction method of inverse z transforms

    3. Residue method

    4. Power series of inverse z transform

    Long Division Method 

    This method is applicable when:

    • There is a ratio of two polynomials

    • The polynomials can not be factorized

    To apply inverse z transform with this method, the division process of numerator with denominator is carried out. The resultant equation is then passed through the procedure of inverse z transform and we get the results. It is a complex method. 

    Partial Fraction Method of Inverse z Transform

    This is the method that involves the rules and procedure of partial fraction (we have received it in the previous lecture) and after that, the inverse z transform is applied. 

    Residue Method

    There are different names for this method including the inversion integration method and contour integral method. For this method, we have to follow the equation given below:

    The inverse z transform is obtained by summing up all the residues of this equation from the poles point of view.

    Power Series of Inverse z Transform

    In the end, this is the simplest and easiest way to find the z transform. In this method, the equation is expanded and we get the series of ascending powers. After that, the coefficient of z^-n is the required result. 

    Inverse z transform in MATLAB 

    To apply the inverse z transform in MATLAB, we use the following formula:

    iztrans(x)

    For convenience, we have put the process of z transform and the inverse in the same code. 

    Code:

    syms n;

    f=sin(2*n)

    F=ztrans(f)

    G=iztrans(F)

    Output:

    You can clearly see that we got our required result easily. This type of transforms is used when the data is being transferred to different networks. There are many applications of this transform and you will learn about them in the next section. 

    We have started the discussion of another transform named the z transform that is somehow similar to the Laplace transform that we have learned in the previous sessions. Z transform is a useful mathematical tool and we studied the ROC, procedure, and the inverse method of z transform. We also saw some examples in MATLAB. In the next lecture, we are going to learn some other basic information on the same topic.

    Properties of Laplace Transform in MATLAB

    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.

    Linearity in the Laplace Transform

    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.

    Time Delay of Laplace Transform

    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


    Nth Derivative of Laplace Transform

    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.

    Frequency Shifting Property

    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. 

    Multiplication of Time in the Laplace Transform

    When multiplying the Laplace transform with the time T, the result obtained is:

    T f(t) ⟷ (−d F(s)⁄ds)

    Complex Shift Property 

    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)

    Convolution of the Laplace Transform

    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

    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. 

    The Step Function of the Laplace Transform

    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. 

    Inverse Laplace Transform

    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. 

    Inverse Laplace in MATLAB

    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. 

    What are comments in a programming language?

    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. 

    Partial Fraction Expansion and Inverse Laplace Transform

    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:

    1. s^2

    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.

    Partial Fraction and Laplace Transform in MATLAB

    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. 

    Applications of the Laplace Transform

    Have a quick review of the Laplace transform here:

    Data mining

    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. 

    Signal processing

    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.

    Control system

    This transform is used to convert the governing complex equations into simple differential equations. 

    Probability

    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. 

    Integrated system

    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.

    Data security engineer advice for regular Internet users

    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.

    What do data security engineers recommend for people who don't work in security?

    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?


    Step 1: Don't breeze through sites with suspicious links or attachments.

    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.

    Step 2: Use two-factor authentication whenever possible.

    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.

    Step 3: Update and patch applications

    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.

    Step 4: Update your browser with new and fresh security features.

    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.

    Step 5: Make good, informed decisions about what you share online.

    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.

    Step 6: Encrypt your devices.

    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.

    Step 7: Be smarter about the apps you install.

    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?

    And finally...

    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.

    Introduction to Quantum Tunneling

    Hi readers! Hopefully, you are doing well and exploring something fascinating and advanced. Imagine that particles can pass through walls but not by breaking them down? Yes, it is possible. Today, we will study Quantum Tunneling.

    Quantum tunneling may be one of the strangest and illogical concepts of quantum mechanics. Quantum Tunneling proves the phenomenon of particles like electrons, protons, or even whole atoms percolating through the energy barrier of potential energy, although they do not appear to have sufficient potential to slide over it. The classical physics version of this ball at this point would merely reverse.

    Nevertheless, in the quantum realm of things, particles now act like waves, and waves can pass through and even over barriers with some nonzero probability of the particle emerging at the far side.

    This cannot be explained according to classical mechanics and serves to demonstrate the essentially probabilistic nature of quantum theory.  While it may sound like a theoretical fad, quantum tunneling has significant and real uses. It is the preeminent mechanism of alpha decay in nuclear physics, the operation of tunnel diodes and quantum transistors in modern electronics, and the high-resolution imaging of scanning tunneling microscopes. Even in biology, tunneling happens in enzyme reactions and energy transfer in photosynthesis. With the technology continuing to move towards the nanoscale, quantum tunneling becomes more and more important. What is more, not only does it speak more about the quantum world, but it also offers new horizons in science, engineering, and future technologies.

    In this article, you will know Quantum Tunneling, its background history, key features, the Schrödinger equation, tunneling through a potential barrier, applications, limitations, and future. Let’s unlock in-depth details.

    What is Quantum Tunneling? 

    Quantum tunnelling is a quantum mechanical effect at the particle level where they can pass energy barriers that, from a classical viewpoint, they could not. In the classical world, when a particle does not have enough energy to go over an energy barrier, they are reflected. However, in the quantum realm, the particles are also wave-like.

    These waves can propagate within and without barriers, so the chance is that the particle materializes on the other side even without enough energy to cross it.

    This effect lies in the essence of many natural and technical phenomena. For instance, quantum tunneling makes nuclear fusion take place in stars, whereby particles merge despite their strong repulsion force. It describes the decay of radioactive atoms and technologies such as the scanning tunneling microscope and flash memory. Quantum tunneling is a violation of our conventional expectations of particles and further drives the new research in computer science, physics, and chemistry, as shown in the figure below.

    Historical Background of Quantum Tunneling:

    • 1920s Origins: Quantum tunneling can be traced back to the infancy of quantum mechanics in the 1920s.
    • Friedrich Hund (1927): The first to describe tunneling was German physicist Friedrich Hund, who was studying how electrons behaved in a molecular bond.
    • George Gamow: He included quantum tunneling in his work on nuclear physics when investigating alpha decay, which involves helium nuclei tunneling out of (classically) insufficient energy in an atomic nucleus.
    • Ronald Gurney & Edward Condon: Independently of the other two, they came up with analogous theoretical models of tunneling based on the Schrödinger equation and supported its probability-based interpretation.
    • Advancement of Quantum Theory: These initial efforts entrenched tunneling as a central concept in quantum mechanics, accounting for occurrences that were inconsistent with classical physics.
    • Experimental Validation: Despite its early conceptual status, tunneling theory became progressively accepted within the scientific community and validated while explaining experimental results on nuclear decay processes, followed by experimental results in solid-state physics.
    • Will Legacy: Quantum tunneling is still an influential concept in modern physics, chemistry, and technology, and has informed our understanding of sub-atomic phenomena.

    Key Features of Quantum Tunneling:

    Quantum tunneling is a special quantum mechanical phenomenon that stands apart from classical physical behavior. The following are the key features that render tunneling both interesting and central in quantum theory and applications.

    1. Barrier Penetration Despite Insufficient Energy:

    One of the most noticeable features of quantum tunneling is the capability to deliver quantum particles through the obstacles of energies that they could not cross classically. In classical physics, a particle will be reflected if it does not have enough kinetic energy to jump over a potential barrier. However, in the quantum world, particles act as waves, and these waves can include areas that the mechanics of classical principles say shouldn’t exist. It implies that regardless of whether a particle lacks energy to go over the barrier, there’s still a likelihood that there’s an opportunity to find it on the other side the quantum tunneling.

    2. Continuity of the Wavefunction and Decay:

    The wavefunction allows tunneling, a phenomenon arising from a property of quantum mechanics, in that it predicts the probability amplitude for finding a particle at some given location. When a particle passes through a potential barrier, the wavefunction doesn't just zero out. Instead, it gradually falls off within the barrier. For a thin enough or not exceedingly high barrier, the wavefunction can be allowed to have some non-zero value on the far side, thus allowing the particle to "show up" there with some likelihood.

    3. Exponential Dependence on Barrier Properties:

    The second unique feature of quantum tunneling is its exponential dependence on barrier characteristics—height and width, specifically. The probability of tunneling decreases exponentially as the barrier increases or becomes wider. This relationship is most commonly expressed in terms of the transmission coefficient:

    T∝e-2ka

    Where κ depends on the mass of the particle and the difference between the barrier height and particle energy, and aaa is the width of the barrier. This means even small changes in the barrier can drastically affect the tunneling probability.

    4. Mass and Energy Dependence:

    The probability of tunneling is also determined by the mass and energy of the particle. The tunneling probability is higher for the lighter particles, such as electrons, than it is for heavier ones like protons or atoms, and more so where the energy barrier between the particles and the barrier is small. This explains why tunneling is usually witnessed with the subatomic particles in the quantum scale systems.

    5. Probabilistic, Not Deterministic:

    Tunneling is probabilistic—it does not occur all the time when a particle meets a barrier. Instead, it is controlled by the laws of probability. The wavefunction gives us the probability that the particle is on the other side of the barrier, but each of the events occurs randomly. This randomness is an inherent property of quantum mechanics and what defines it as a separate system from classical systems.

    6. Universality Across Systems:

    Quantum tunneling does not depend on there being a single type of system around, its effects occur on a ye-off-the-scale range of physical contexts. Quantum tunneling occurs in nuclear fusion, in semiconductor technology, and at the level of chemical reactions, and there is biology as well. Its universality renders it as much a theoretical as an enormously applied concept throughout disciplines.

    The Schrödinger Equation and Tunneling:

    The basis of quantum tunneling lies in the time-independent Schrödinger equation:

    Where:

    •  (x0) Is the wavefunction of the particle,

    • V(x) is the potential energy,

    • E Is the total energy of the particle?

    • ℏ is the reduced Planck constant,

    • m It is the mass of the particle.

    When a particle approaches a potential barrier,V(x)>E the classical interpretation predicts reflection. But the Schrödinger equation allows for a decaying exponential solution inside the barrier, meaning the wavefunction does not abruptly stop. A non-zero amplitude on the far side of the barrier indicates the particle has a probability of being found there—this is quantum tunneling.

    Tunneling Through a Potential Barrier:

    Quantum tunneling can be clearly understood using a one-dimensional potential barrier problem in quantum mechanics. Imagine a particle approaching a rectangular barrier with height Vo and width a. If the particle's energy E is less than Vo(i.e.E

    This happens because particles in quantum mechanics are described by wavefunctions, not just fixed positions and velocities. These wavefunctions don't stop abruptly at the barrier; they decay inside it. This decay means there's a non-zero probability of the particle being found on the other side, even though it doesn’t have enough energy to cross over classically.

    Wavefunction Behavior in Regions:

    Region

    Potential 

    Wavefunction Form

    Before Barrier

    V(x)=0

    (x)=Aeikx-Be-ikx

    Inside Barrier

    V(x)=Vo

    (x)=Cekx-De-kx

    Beyond Barrier

    V(x)=0

    (x)=Feikx

    Where:

    k=2mE/ℏ  (wave number in free space)

    k=2m(Vo-E/ ℏ (decay constant inside barrier)

    Transmission Coefficient (T):

    The probability of the particle tunneling through the barrier is given by:

    Te-2ka

    This shows that the tunneling probability decreases exponentially with greater barrier width aor height Vo​. This explains why tunneling is significant only at very small (atomic or subatomic) scales and why it's rare in the macroscopic world.

    Applications of Quantum Tunneling in Real Life:

    Quantum tunneling is central to both natural and contemporary technologies. Although contrary to the general intuition of the classical world, tunneling is a powerful concept that has extremely practical applications in everyday life mentioned in the figure below.

    1. Alpha Decay in Nuclear Physics:

    One of the first phenomena seen to be described by quantum tunneling is alpha decay. During this phenomenon, an alpha particle (two protons and two neutrons) is emitted from a radioactive nucleus. According to classical arguments, the particle is not sufficiently energetic to break the nuclear potential barrier. Through tunneling, however, it can "seep" through and cause radioactive decay. This account, offered by George Gamow, works nicely with the experiment.

    2. Scanning Tunneling Microscope (STM):

    The STM is a revolutionary device that uses tunneling current to image surfaces at the atomic level. When a conducting tip is brought very near to a surface and a voltage is applied, electrons tunnel between them. The current is highly sensitive to distance, allowing the microscope to detect atomic-scale variations and even move individual atoms.

    3. Tunnel Diodes:

    Tunnel diodes rely on quantum tunneling for high-speed operation of electronics. Owing to heavy doping, electrons can tunnel through the p-n junction at very low voltages. This forms a negative resistance area, and hence, tunnel diodes are best suited for high-speed and microwave devices such as oscillators and amplifiers.

    4. Quantum Computing:

    In quantum annealers, like D-Wave-built ones, tunneling is useful to discover solutions to knotty optimization problems. The system can tunnel across energy barriers to move out of local minima and achieve global minima, which classical systems have problems with. 

    5. Fusion in Stars:

    Tunneling allows hydrogen nuclei in stars to tunnel past their electrostatic repulsion and combine to form helium. Without tunneling, the Sun would not be able to sustain the fusion reactions that drive its light and heat today.

    Limitations and Challenges:

    Quantum tunneling, although useful, has limitations in practice:

    • Control and Predictability: Tunneling is probabilistic rather than deterministic.

    • Energy Efficiency: In nanoelectronics, unwanted tunneling results in leakage currents, leading to power loss.

    • Scalability: Quantum tunneling's application in next-generation quantum devices (such as qubits) is difficult to stabilize and control owing to decoherence and environmental noise.

    Future of Quantum Tunneling:

    As we proceed further into the nanoscale and quantum age, tunneling will be of even greater technological importance:

    • Quantum computing hardware will depend ever more on tunneling for state control.

    • Nanoelectronics and spintronics will extend the limits of material science with transport based on tunneling.

    • Fusion power development potentially might employ insights on quantum tunneling to achieve higher confinement and reactivity at lower temperatures.

    Conclusion:

    Quantum tunneling is the most intriguing and paradoxical effect of quantum mechanics. It violates classical intuition by enabling particles to pass through energy barriers that, according to everyday physics, must be impenetrable. What was initially an intellectual curiosity has evolved into one of the foundations of contemporary physics and engineering.

    From explaining radioactive decay and nuclear fusion in stars to enabling the functioning of scanning tunneling microscopes and ultra-fast tunnel diodes, quantum tunneling is important in terms of natural events and high-tech inventions. It is also one of the ideas upon which new technologies like quantum computing are based. Here, tunneling helps the systems solve complex problems by tunneling their way out of local energy minima.

    Its wide-ranging implementations in cosmic orders and further globally into the nanotechnology world show how deeply tunneling has been woven into the structure of our universe. While the scientists keep digging into the quantum world, tunneling not only discovers nature’s secrets but also opens the door to the long-awaited innovations that have seemed impossible. In a way, it is an entrance into the future of science and technology.https://images.theengineeringprojects.com/image/main/2025/06/introduction-to-quantum-tunneling-6.jpg [Introduction to Quantum Tunneling_ 6]

    Basics of Laplace Transform in Signal and Systems

    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?

    What are Transforms in Signals and Systems?

    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. 

    Why do we use Transforms in Signals and Systems?

    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.


    Types of Transform in Signals and Systems

    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:

    1. Laplace Transform

    2. 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. 

    Laplace Transform in Signal and System

    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 that 

    The 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.

    The Laplace Transform in MATLAB

    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. 

    Syntax of the Laplace Transform in MATLAB

    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.

    Code of the Laplace Transform in MATLAB

    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. 

    Bilateral Laplace Transform

    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.

    The Difference Between Unilateral and Bilateral Laplace Transform


    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.

    Properties of Convolution in Signals and Systems with MATLAB

    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. 

    The Properties of Convolution

    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:

    1. Commutative property

    2. Associative property

    3. Distributive property

    Commutative Property of Linear Convolution

    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. 

    The Associative Property of Linear Convolution

    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.

    The Distributive Property of Linear 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

    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.

    The Formula of Correlation

    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. 

    Types of Correlation

    Based on how the correlation is solved in different ways, the correlation is broadly divided into two different types:

    1. Autocorrelation

    2. Cross-correlation

    Autocorrelation

    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.

    Auto-correlation in MATLAB

    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


    Cross-Correlation

    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.

    Cross-correlation in MATLAB

    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. 

    The Difference Between Convolution and Correlation


    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.

    Applications of Convolution


    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. 

    Image Processing Techniques

    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. 


    Customizing the Pattern using Impulse Response

    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. 

    Audio Processing using Convolution

    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.


    Multiplication of Polynomials

    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. 


    Artificial Intelligence and Convolution

    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. 

     

    Convolution in Optics

    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.

    Types of Convolution in MATLAB

    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?

    What is the convolution of signals?

    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.

    The formula of Convolution

    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.

    Types of Convolution

    Basically, there are two types of convolution that are used in signal and system. These are

    1. Linear convolution

    2. Circular convolution

    A brief description of each of them is given next:

    Linear Convolution

    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.

    Procedure for Linear Convolution of Signals

    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.

    1. Replace T with t

    2. Time reversal in h(t)= h(-t)

    3. Time shifting in h(t)= h(t-t)

    4. Multiplication of h(t-t) with x(t)

    5. 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.

    Circular 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:

    1. Concentric circular convolution

    2. Matrix circular convolution

    We are going to discuss both of them in the next section.

    Concentric circular convolution

    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.

    Matrix circular convolution

    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.

    Convolution Procedure in MATLAB

    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.

    Step for Linear Convolution in MATLAB

    • Fire up your MATLAB software.

    • Go to live editor or command window to write the code.

    • Click the “Run” button.

    • Save program.

    Linear Convolution using Function

    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;


    Linear Convolution without using Function

    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 in MATLAB

    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;


    Length Function

    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.

    The Max function in MATLAB

    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.

    Difference Between Linear Convolution and Circular Convolution




    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)


    Conclusion

    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.

    Syed Zain Nasir

    I am Syed Zain Nasir, the founder of <a href=https://www.TheEngineeringProjects.com/>The Engineering Projects</a> (TEP). I am a programmer since 2009 before that I just search things, make small projects and now I am sharing my knowledge through this platform.I also work as a freelancer and did many projects related to programming and electrical circuitry. <a href=https://plus.google.com/+SyedZainNasir/>My Google Profile+</a>

    Share
    Published by
    Syed Zain Nasir