Introduction to Matrix in MATLAB

Hello, learners welcome to The Engineering Projects. We are working on MATLAB, and in this tutorial, you are going to learn a lot about matrices in MATLAB. We are going to learn them from scratch, but we will avoid unnecessary details about the topic. So, without wasting time, have a look at the topics that you will learn in detail.

  • What is an array?

  • What is the matrix?

  • How can we declare a matrix in MATLAB?

  • What are the different types of matrices?

  • Can we find the unknown values of two equal matrices?

  • How can we solve the simultaneous equation in MATLAB?

What is an Array?

In this world of technology, the use of data is everywhere, and therefore, we can say there is a need for arrays in every field. You will find the reason soon. But before this, look at the introduction of an array.

 An array is a simple data structure that contains a collection of data presented in contiguous memory locations.

So, the term “contiguous” used in the definition tells us that the data is in a continuous format, so we are not required to search here and there because the data is in a structured format. Moreover, arrays are of many kinds, such as

  • Two-dimensional arrays

  • Three-dimensional arrays

In different types of cases, the suitable array is picked up so that we may get the best result with limited memory occupancy. With this type of foundation concept, we can now move forward toward our main topic, which is matrices. 

What is a Matrix?

In real-life applications and in higher studies, matrices are used in plenty in different forms, and therefore, we have decided to talk about them from a very basic level since it is important to understand the key features of the topics we are studying. Moreover, matrices are introduced in early classes, and it is important to refresh the basics in our minds so that we may proceed to the more complex problems. Here is the definition of "matrix":

A matrix is a two-dimensional array in the form of an ordered rectangular array enclosed by a square bracket that has entries of the same kind in it in the form of real or complex data.

The plural of the matrix is matrices, and sometimes the rectangular bracket is replaced by the parentheses according to the case. Just look at the image given below:

This is a matric that contains nine elements, and you can also name this matric anything you want. In this way, it becomes easy to deal with more than one matrix, and you will see this action soon.

Order of a Matrix

To proceed forward, you must know the types of matrix and, for this, it is important to know the order of the matrix.

The matrix given above is a square matrix and the horizontal lines are called columns, whereas the vertical entries are termed the rows of that particular matrix.

If we represent the rows with the name m and the columns as n, then the order of the matrix is given as:

mxn

In this way, it is clear that the matrices given above have the order 3x4. If it seems to be an unnecessary thing to you, think again, because, with the help of order, we can know the type of a matrix and then perform different types of operations on it. But before this, have a look at some code in MATLAB to design matrices of different kinds. 

Code for the Simple Matrix

The Matrix is easily used in MATLAB, and you can start working with it by following the simple steps given below:

  • Start your MATLAB software.

  • Go to the command window.

  • Start writing the following code:

A=[23 14 -8 33; 17 -102 0 37;3 -31 98 4];

  • Press enter. 

In the image given overhead, these are the same entries that we have seen in the image given above, and in MATLAB, you will see the following result:

The square bracket is not shown on the sides of the array in MATLAB. As you can see, the semicolon after every three entries indicates that the row is completed and the MATLAB compiler has to start the other row. 

Here, A shows the name of the matrix that is compulsory, and you can name your matrix any word. If you do not follow the exact format and provide the number of entries different in rows, you will get the error. Once you know how to get started, you are ready to learn about the types of matrices.

Types of Matrices

There are several different types of matrices, and you can perform different arithmetic operations on the matrices only if they are of the same kind. This condition is not applied to all the operations, but most of them follow these rules. Here are some important types of matrices.

Row Matrix

A row matrix contains only one row and it is one of the simplest forms of a matrix. In this way, we get the matrix with a horizontal shape. The order of this matrix is:

mxn=1xn

Where n may be any number. 

Column Matrix

As you can guess, the column matrix is a type of matrix containing only one column and one or multiple rows. In this way, we get a matrix that has a vertical shape. Have a look at the order of a column matrix:

mxn=mx1

Where m may be any number, but the value of n is always one.

Square Matrix

A square matrix always has the number of rows and columns equal. It means, that no matter what the total number of entries is, the number of entries in each row and column must always be equal. In other words,

m=n

When you examine the example of a square matrix, you will get the reason why it is called so. The shape of this type of matrix is always square.

Rectangular Matrix

A rectangular matrix is one that has the arrangement of elements in such a way that the number of rows of the matrix is not equal to the number of columns. The same statement can be represented in the equation given next:

m!=n

Therefore, the matrix formed is in a rectangular shape, either in vertical format or horizontal format, according to the number of rows and columns.

Diagonal Matrix

We all know that the diagonal is the line or area that joins the upper left area with the lower right area of a rectangular or square. By the same token, a diagonal matrix is the one that contains all the diagonal values equal to zero and s in such a way that all the values other than the diagonal are zero. It will be clearer when you see the example of the diagonal matrix. We have set the examples of all the types of matrices that we have defined previously into a single MATLAB screen so you may have the best idea of each of them.

Code and Output

Moreover, here you can observe that instead of naming the matrices A, B, and so on, we have used the real names of the matrices for a clear declaration. Your homework is to make examples of each of them by yourself for the sake of practicing.

Finding the Unknown Values Between Two Matrices

Do you remember when we said the order of the matrix matters? This is one of the uses of an order of a matrix. Suppose we have two matrices named A and B, declaring that both are equal. This means that each corresponding value of a matrix A at position row 1 column 1 is equal to the corresponding value of the same position of matrix B. This is true for all the remaining values q of both matrices. Let me be clear with one example. Have a look at the picture given below:

So, the value of r and, in return, the value of all r variables in each entry can be easily obtained by following the rules of the equation. It is one of the simplest examples of doing so, but in real life, we face complex problems. So, we use MATLAB for simplicity and accurate results. Have a look at the MATLAB code where we are going to show you an application of you can easily solve the simultaneous equation in MATLAB as well. 

Solving Simultaneous Equations in MATLAB

By using the property of the matrix of equality in more than one matrix, we can easily solve the simultaneous equations that are difficult and time taking if we solve them by hand. So let's see how we can declare and solve the simultaneous equation in MATLAB.

Code:

syms x y

equa1= 6*x + 9*y==13;

equa2= 9*x + 6*y==12;

[A,B]= equationsToMatrix([equa1,equa2],[x,y])

z=linsolve(A,B)

Output:

Understanding the Code

To understand this code, you have to learn the basic definition of the function we have used in the code. It is the equationsToMatrix function. 

equationsToMatrix Function

The equationsToMatrix is a pre-defined function of MATLAB that converts the linear equation into a matrix so that we can use different operations on it more efficiently. It does it in the same way as we do in real life while solving the simultaneous equation with pen and paper. There are three types of syntax if this particular function. The one that we have used has the following syntax:

[A,b] = equationsToMatrix(eqns,vars)

Here, a minimum of two equations are required and the variables have the same condition. You must keep all the functions in mind and have to follow the exact syntax. Otherwise, it will show an error.

linsolve Function in MATLAB

In MATLAB, to solve the linear equation, we use this pre-defined function as it works in two ways:

  1. LU factorization with partial pivoting when in equation AB=X, A is a square. 

  2. QR factorization, otherwise.

In our case, it has used the QR factorization. Now, you are able to understand the code clearly. 

  • First of all, the syms sign tells MATLAB that we are defining the variables. These may be one or more. But, we wanted two variables here, and we named them x and y. 

  • Now, we simply provide the values of the equation to MATLAB and store both of them into variables named equa1 and equa2 respectively. 

  • The values of variables and equations are fed into the eqautionToMatrix function to convert the linear simultaneous equation into a matrix for easy solving. 

  • In the end, we simply named a matrix z and told MATLAB that we wanted the value of variables x and y.

Simultaneous Equation in MATLAB: Method 2

By the same token, we can use the other method that is similar to it but the way it solves the equation is a little bit different. 

Code:

syms x y

equa1= 6*x + 9*y==13;

equa2= 9*x + 6*y==12;sol=solve([equa1,equa2],[x,y])

asol=sol.x

 bsol=sol.y

Output:

Here, the only pone this is to understand. sol.x and sol.y are the functions that are used by the compiler to find the value of variables x and y respectively. You can use any variable with this sol function, after naming them at the beginning. After that, a variable is used to store and present the value of the answer obtained.

It was an interesting lecture about the matrix, and we worked a lot from scratch to the end on many topics. We have defined the arrays and seen the introduction of the matrix. We also found information about the types of matrices. Once we have a grip on the basics, we learn that a matrix can be used to find the unknown value of two matrices, and as an application of this method, we found the values of the variable by using linear equations and learned how to declare, use, and solve the linear equation with the help of matrices in MATLAB.

Ramp Response of an LTI System in MATLAB

Hello readers, Welcome to another tutorial about the signal and system. In this lecture, you are going to read details about the ramp response of a signal. In the past lectures, we have been dealing with different types of responses of LTI systems, and therefore, we know that linear invariant systems, or LTI systems, are those which follow the rules of linearity and are also time-invariant. So, at present, our focus is to examine what happens when the ramp signals are fed into the LTI system and which type of output signal we receive. Here is a glimpse at today’s topic that we will learn deeply.

  • What is the RAMP signal?

  • How can you define the ramp response?

  • How to use the ramp function in MATLAB to get the ramp response?

  • What are some important properties of the ramp function?

  • How is ramp response used in different fields in different ways?

What is a Ramp Signal?

We all know that a signal is a function of one or more variables that are independent and contain some information in them. When talking about ramp signals, we get the following definition:

“A ramp signal is the one that always has its initial condition at 𝑡  = 0,  and with time, this signal increases exponentially. Therefore, it is linear in its behavior with time.“

So, when representing these with the help of graphs, we get a smooth result all the time instead of any abrupt change in the pictorial representation. 

As with other types of signals, ramp signals can also be described in two ways:

  • Continuous-time signal

  • Discrete-time signals

When the ramp signal is in the form of continuous values, we represent them as:

r(t)= { t for t=>0 } and {0 for t<0}

Similarly, the same condition in the discrete-time format is described as

r(n)= { n for n=>0 } and {0 for n<0}

Let us clarify the meaning of the statements given above. In both cases, the value of t or n increases with time simultaneously. Therefore, we get the smooth slop in the case of continuous signals and smooth points when we are dealing with discrete ramp signals. In other words, the values on the x-axis and the y-axis for a ramp signal are always equal if we are plotting a graph for them.

What is the Ramp Response?

As we have discussed at the beginning of this lecture, linear time-invariant systems have the linearity property, and you can use the ramp function in the time-invariant system. It has the input at one end, then the input faces some procedures according to the conditions, and from the other side of this LTI system, we get the output. So, in simple words, we define the ramp response as:

“The ramp response is one of the responses of the LTI system when the signal used as input is the ramp signal and the output of that system has the same features.”

In some places, the ramp function is defined in other ways, but the basic definition remains the same as we have provided you before. Other ways to introduce the ramp function are:

The resultant value is when the mean is calculated between the independent variable and its absolute value, which is called the ramp response.

R(x)=(x+|x|)/2

Here,

R= ramp function 

x = the variable based on which R is taken.

Ramp Response in MATLAB

Code:

num=[0.9 0.18 0.27];

den=[1 0.2 0.3 0.4];

n=0:0.1:7;

x=n.*(n>=0);

y=filter(num,den,x);

stem(n,y)

xlabel('n /The Engineering Projects.com')

ylabel('amplitude')

grid on

title('Ramp Response in CT') 

Output:

We have used the filter function in the previous tutorials as well. But, for a revision, it is important to know about it again. 

Filter Function in MATLAB

The filter function is used when the digital filters are to be applied to a vector in MATLAB. The information that is to be fed into this function is delayed before this function. The syntax is given as

filter(b,a,x)

Where

b=co-efficient of the numerator

a=co-efficient of the denominator,

And x is different in different conditions. 

  • Filter returns the filtered data as a vector with the same size as x if x is a vector.

  • The filter operates along the first dimension of a matrix if x is one, and it returns the filtered data for each column.

  • If x is a multi-dimensional array, the filter operates along the first dimension of the array whose size is not 1.

In our case, num and den are the matrices. So we are using the second case.

Explaining Code for Ramp Response

Have you seen the code? For a super easy-to-understand, we are going to discuss every step in detail. 

  • In the first step, we declared two arrays and stored their values in the num and den separately. 

  • In the second step, the time is provided to MATLAB, which shows the time has an upper limit of seven and a lower limit of zero. The interval between the times is taken as 0.1.

  •  Now, we have just used these two arrays for the multiplication and used the dot along with the multiplication sign so the compiler may understand that it has to multiply every term in the loop. 

  • In the next step, we are going to use all the results in the filter function, and this is the step that provides us with the results in a better manner. 

  • The results are then fed into the variable y. 

  • In the end, to get the result graphically, we used the stem function and provided the values of n as time. 

Note:

If you want to have the same graph in the continuous-time signal, you just have to:

  1. Replace the n with t for the best representation.

  2. Replace the stem function with the plot function.

In this way, you will get the same graph, but the slope will be smooth. 

Properties of the Ramp Function

To deal with different types of cases when using ramp response, one must know the properties of ramp response in detail to avoid the long calculation all the time. So here are some of these:

Laplace Transform of Ramp Response

The Laplace transform is used to convert the system from the time domain to the frequency domain, and when talking about the ramp function, it says that the Laplace transform of a ramp function results in a calculation that is equal to the square of the variable based on which the integration of that ramp response occurs.

Observe that this property is valid for the single-sided Laplace transform. 

Fourier Transform of the Ramp Function

The Fourier transform is another way to convert the function from the time domain to the frequency domain so that it may become easy to deal with that particular function. The process of Fourier transform on the ramp function provides us with the following results:

Non-Negative Nature of Ramp Function

At the start, we mentioned that the ramp function does not exist in negative values and that the values are always in positive coordinates. So, we can represent this property mathematically as

∀ x ∈ R: R(x)>=0

In this way, the definition and nature of the ramp response are now clearer in our minds. There are certain conditions when the negative values of the ramp function and in return, ramp response are obtained. In such conditions, the negative values are always ignored.

Derivative of Ramp Function

To know about this property, you must know about the Heaviside step function. It is the type of step function that always has a zero for negative values and one for positive values. It is usually denoted with a capital H. When we take the derivative of the ramp function, we get the Heaviside step function. When writing it mathematically, we get the following equation:

R’(x)= H(x)          for x !=0

There are different conditions and properties of the Heaviside step function, but we are not going to explain them because it is out of the scope of this lecture. For now, you just have to remember the equation that we discussed just before this paragraph. 

Applications of Ramp Response

We know the signals are important in almost every type of field of science and therefore, we have the emphasis learning more and more about them. When the topic is ramp response, there are different ways in which ramp signals are used, and therefore, ramp response also has an application in that particular field. So let’s discuss the important fields where ramp function and, in return, ramp response are used. 

System Testing using Ramp Response

We know that in the ramp function, the values on the x-axis are equal to the y-axis and these are always positive values. Therefore, we can guess the results before the time. This property is easily used in different systems for testing different conditions or when starting a new system, it is used to check particular features. 

Ramp Response in Engineering Fields 

In different engineering fields, signals are used in different ways, as we are learning in one such subject, “Signal and System”. Electrical, computer, civil, and other engineering disciplines involve the use of ramp signals and ramp responses. 

Ramp Response in the Filed of Finance 

Those who belong to the field of finance know that the payoff of the call option is in the form of a ramp function, and therefore, ramp response has major usage in this field. The put option is set by flipping the ramp horizontally, and the short option is obtained when the ramp is flipped vertically. The graph formed in this way is called the "hockey stick" because of its shape. 

It becomes easy to deal with the results, and we get accuracy.

Using Ramp Response in Statistics

When we use the ramp function, we face different conditions while studying statistics. Some cases are

  • Multivariate Adaptive Regression Splines or MARS

  • Hinge Function

To deal with such complex calculations, it becomes easy to use the ramp properties so that unnecessary work may be ignored. For example, the non-negative property of the ramp function provides us the facility to ignore the negative values and focus on the calculations of positive values. 

Traffic Signaling and Ramp Response

It may look unusual, but the real-time application of the ramp function is in the traffic signals. A bottleneck is a situation when on the highway several vehicles are entered in an unmarred way and it results in the blockage of traffic. A ramp signal is used to break up this blockage, which is a cost-effective way to deal with this situation. The work is done. When the ramp signal is applied to the traffic lights effectively, this is one of the easiest ways to deal with this situation.

Today, we learned a lot about the ramp response, ramp function, and unit ramp signal. We saw the introduction of all of these and the interesting thing about the ramp response was the code of the ramp response in MATLAB because it was so clean and easy to understand. In addition to this, we have learned about some properties of the ramp function that helped us to clear the concepts and to know how we can skip long calculations all the time if we know the properties of the ramp function. In the end, we had a glance at the application of the ramp function in different fields of science, such as statistics, engineering, and finance. We hope it was an informative lecture for you. Stay with us for more interesting lectures about signals and systems.

Frequency Response of an LTI System in MATLAB

Hello learners, Welcome to another tutorial on signals and systems. We are learning about the responses of the signals. We all have experience in situations where the change in the frequency of a system, such as radios or control systems, results in a change in the working or result of that system. So we have the idea that frequencies play an important role in different types of systems. In the previous lecture, we saw the impulse response of the system. Our mission today is to learn about the frequency response of the LTI system. We will learn all the basic information about the topic and will revise some important points as well. To do this, have a look at today’s concepts:


  • What is the LTI system?

  • What is frequency response?

  • How is frequency response performed without the function in MATLAB?

  • How is frequency response performed in MATLAB by using the function?

  • What are the applications of frequency response in other fields?

What is the LTI System?

We all know that a system is something that has input at one end and, after certain procedures on the input, the output is obtained from the other end. When talking about the LTI system, we define it as:

“The linear time-invariant system, also known as an LTI system, is one that possesses both linearity and the time-invariant property simultaneously."

Now, to make a solid foundation, let's recall that a signal is represented in the form of a wave, and all the waves are made of three basic quantities:

  1. Magnitude

  2. Phase

  3. Frequency

The time period of the wave is the inverse of frequency, and in this way, if we know the magnitude (amplitude is used interchangeably), frequency, and phases, we can form a wave or signal. 

The Frequency Response of the LTI System

We are using discrete-time signals to learn the frequency response of the LTI system. The frequency response is the steady output of the system when the input is in the form of a sinusoidal signal. Before going into the proper definition of frequency response, you must know about the types of responses in the system. 

Types of Responses in the System

Responses are the types of behavior or results that a system represents. There are two types of responses in the LTI systems:

  1. Transient response

  2. Steady-state response

The details of both of these are not necessary here. To make it simple, we are not discussing the transient response here. 

Introduction to Frequency Response of the LTI System

As we have read a little bit about this function, we know the type of response we are discussing. You must know that frequency is the steady-state response of the system, which means the frequency repose tells us how the system will work in the steady state.

The frequency response of the LTI system is a type of steady response, and both input and output are in the form of sinusoidal waves with the same frequency but with different values of amplitude and phase angle.

r(t)=Asin(ω0)              (eq. 1)

Similarly,

G(s)=G(jω)                 (eq. 2)

If we represent the equation 2 in the form of phase and amplitude. then,

G(jω)=|G(jω)|∠G(jω)

Replacing ω with ω0 we get,

c(t)=A|G(jω0)|sin(ω0t+∠G(jω0))

So, by using these equations, one can calculate the magnitude and phase of the wave through frequency response.

If you have the idea of impulse response that we have discussed in the previous lecture, then you must have an idea of how the LTI systems work. Yet, in the case of frequency response, we are going to study it in another way. It is now time to discuss some examples in which we will get the different procedures to perform the frequency response efficiently in MATLAB.

Frequency Response Without Function in MATLAB

Code:

w=(0:10:600)*pi/300;

z=exp(-1i*w); 

x=3*(1-0.9*z).^(-1);

a=abs(x);

subplot(2,1,1);

stem(w/pi,a) 

xlabel('n /The Engineering Projects.com')

ylabel('amplitude')

title('Magnitude')

grid on

b=angle(x)*180/pi;

subplot(2,1,2);

stem(w/pi,b) 

xlabel('Angle /The Engineering Projects.com')

ylabel('amplitude') 

title('Angle')

grid on

Output:

We have used a new function here, and we want to discuss it before elaborating on the program given above.

Angle of the Wave through the Function in MATLAB

To find the angle at which the wave or, in return, a signal is working, we use the following function:

angle(x)

This function calculates the angle of the wave whose value is stored in x and, after that, using the stem function of results, provides us with the resultant wave. Now let’s move toward the code and match the statements given next with the code.

  • It is a simple program that uses some basic operations. We are using these operations in a different way to get the output of the frequency response. Let’s discuss what happened in this code.

  • First of all, we have provided the value of omega. Here, time is represented in a simple way, as we have been doing it from the beginning so far in this series. Yet, multiplying the whole time period t with pi provides us with the value of omega. 

  • This value is used in the exponential form while it is being multiplied with the imaginary number. So, we are providing a variable z in which the whole value of the is saved. 

  • This is used to provide the equation that we want to work with. 

  • Once we get the equation, we are then using the absolute value of this signal and plotting it on the y-axis where the time period is on the x-axis as always. 

  • To get the angle of the wave, we are multiplying the angle results by 180 degrees and simply representing the data in the form of a discrete value graph. 

Frequency Response Using Built-in Functions

Code:

a=-4*pi:0.4:pi;

num=[7 1] ;

den=[1 -0.32] ;

h=freqz(num,den,a); 

subplot(2,2,1); 

stem(a/pi,real(h)) 

xlabel('n /The Engineering Projects.com')

ylabel('amplitude')

grid on

title('Real Part')

subplot(2,2,2); 

stem(a/pi,imag(h)) 

xlabel('n /The Engineering Projects.com')

ylabel('amplitude')

grid on

title('Imaginary Part')

subplot(2,2,3); 

stem(a/pi,abs(h)) 

xlabel('n /The Engineering Projects.com')

ylabel('amplitude')

grid on

title('Magnitude')

subplot(2,2,4);

stem(a/pi,angle(h))

xlabel('n /The Engineering Projects.com')

ylabel('amplitude')

grid on 

title('Angle')

Output:

We have used some built-in functions of MATLAB here, and the description of all of them is here:

Real value Function in MATLAB

This is an interesting function that takes a signal or wave and provides us with the value of the real part of the wave by ignoring the imaginary part containing values of iota and other imaginary numbers. You just have to feed the value of a signal into it. The syntax of this function is

real(x)

where x is any signal. 

Imaginary Value Function in MATLAB

Yes, you are guessing right. This is the function used to get only the imaginary part of the wave, and the real-time values are ignored with this function.

imag(x)

Here, x is the number/signal, and you just have to put the results into this function. 

Let’s understand the code now.

  • At the beginning of this code, we provided the time period and stored it in the variable a. We used the variable t for this purpose, but I just want to show that it's just a variable and you can name it anything.

  • After that, we provided the information for our equation and then fed it into the built-in function of frequency response to get the results. 

  • In the end, the results are shown with the help of a graph for better representation. 

  • The equation provided by us had different parts, and for the best understanding of the concepts, we used each part of the signal and shown it in the form of a separate signal. 

  • In the second part of the code, we are using the stem operation, in which we use the time period on the x-axis and the imaginary part of the resultant signal on the y-axis. 

  • We all know that magnitude is the absolute value of some wave, and here, we are using the absolute function to represent the magnitude. We have also used this function in the other codes in this series. 

  • The last part contains the angle of this wave, and we have used the angle function here. In this way, the changing angles of the wave throughout this procedure are shown on the graph with the help of stem operation. 

Frequency Response Using Fast Fourier Transform

Let’s try to use some of the concepts of the signal and system that we have learned till now to calculate the frequency response in another way. 

In the previous lectures, we have said that the transforms are used to convert the signal from the time domain into the frequency domain. We are using this concept and converting the frequency domain, and in return, we are simply presenting the signal in graphical form. For this, let’s try the shortest method, which is the Fast Fourier transform, and to make it simpler, we will use the built-in function in the code. All these concepts are used in the code given below, so have a look at them. 

Code:

signal=[11 44 12 27 53 19 34 ];

a=fft(signal);

subplot(2,1,1);

stem(signal,a)

xlabel('n /The Engineering Projects.com')

ylabel('amplitude')

grid on

title('(n,fft(n))')

subplot(2,1,2);

stem(a);

xlabel('n /The Engineering Projects.com')

ylabel('amplitude')

grid on

title('(fft(n))')

Output:

Here you can clearly see that we have provided you with the two types of signals. One has the time on the x-axis and the frequency part on the y-axis. On the other hand, the second wave represents the frequency part of the wave only. 

Application of Frequency Response

As you can see in the information given above, frequency response is the measure of the magnitude and phase of the signals in the LTI system. There are several applications of frequency response, and some of them with their details are given below:

Frequency Response in Sound Systems

We all have experienced the role of frequency in sound devices, especially in the music system, where changing the frequency of the sound system results in a change in the quality of voice and some other features. Frequency response evaluates whether and how well an audio component reproduces each of these audible frequencies, as well as whether it modifies the signal along the way.

Radio Spectrum Frequency Response

There are certain frequencies that come in different regions and using these regions results in interesting applications. Changing in the frequency spectrum results in the usage of frequency response in the field of different cables, such as

  • Video switching

  • Twister pair cable

  • Coaxial cables, 

and some other types as well. 

When changing the radio spectrum of the cables results in a change in the behavior of the cables in working condition and the data rate and other features.

Reading the Waves Through Frequency

Frequencies are used in different ways to measure the infrasonic frequency response. We have seen that the prediction of earthquakes in the past was done with the help of the change in frequencies of waves. Moreover, some specific types of waves are used in the diagnostic and working of brain waves. In this way, frequencies are used in the medical field as well.

Today we read about the frequency response and worked in MATLAB to get the concept through the practical implementation of the signals. In digital systems, frequency response is an important concept, and we have seen its multiple applications in different fields. These are just the introduction and when studied deeply, they can be used in complex systems efficiently. Get ready for other topics related to signals and systems that we are going to discuss with you soon. As for homework, you must practice more and more on these topics and try to solve the problems.  Examples are given in MATLAB theoretically by your own research and match the result to whether you get the same results when trying the theoretical procedures.

Responses of Discrete Time Signals in MATLAB

Hello learners, welcome to another topic of signals and systems. We hope you are having a reproductive day and to add more information in the simplest way to your day, we are discussing the responses in discrete-time signals. If you do not get the idea of the topic at the moment, do not worry because we are going to learn it in detail and you are going to enjoy it because we are making interesting patterns in MATLAB as the practical implementation of the topics. Have a look at the points that we are making clear today. 

  • What is the LTI system?

  • What is impulse response?

  • How can we get the impulse response in MATLAB?

  • How can we have the output signal using codes and impulse response in MATLAB?

As we have learned so far in this series, there are two types of signals based on the shape of the signal we obtain, and these are

  1. Discrete-time signals

  2. Continuous-time signals

The focus of our topic is discrete-time signals in which the points of the signals are not connected with each other, but we get a line for each point in the graph, and in this way, we get a non-continuous wave. There are different types of operations that can be performed on discrete-time signals to get useful results from them. The types of operations that we are going to discuss on discrete-time signals are

  1. Impulse Response

  2. Frequency Response

Both of them are simple yet different from each other, and we are going to discuss all the necessary details about the impulse response in the next section. But to make a solid foundation, let us first define the LTI system. 

What is an LTI System?

We have read about the types of systems at the beginning of this course, and we know that:

“The LTI system, or the linear time-invariant system, is those which have both characteristics at the same time, that is linearity and the time-invariant property."

We are now moving towards the introduction of the impulse response.

Impulse Response in DT Signals

Recalls that a system is something in which we provide the input at one end of the system, the operations in the system take place on the input, and from the other end of the system, we get the output. 

Now coming towards the impulse response, it is the procedure or the operation that is implemented on the discrete time signal and after the application of this signal, we get the required output. To clarify this statement, have a look at the image given below:

The impulse response here is the procedure that converts the input into the required output. When calculating the result theoretically, we use the mathematical form of this image. 

x[t]=h[t] * y[t]

Considering the equation given above, we see that it is in the form of a time domain, and if we want to change it into a frequency domain, then we are using the Laplace transform (if you don't know it, recollect from the previous lectures).

L(x[t])=(h[t] * y[t])

Y(s) =X(s). H(s)

And in this way, we can also change the form of the equation to get the required quantity. 

Y(s) =X(s). H(s)

Or

H(s)=Y(s)/X(s)

So, in this way, we can calculate the impulse response of the discrete-time signals. The H(s) here is called the transfer function, and these are used interchangeably. When we use the function in the time domain, we call it an impulse response, and in the case of the s-domain, we call it the ratio of input and output transfer function. Both of these are used for the LTI system.

While performing the transform, the signal from the time domain to the frequency domain, you can also use the other forms of transforms as well, if you do not want to use the Laplace transform. The other two types of transform that we already know are

  1. Z transform

  2. Fourier transform

Impulse Response in MATLAB

Once you know the basic definition of the impulse response, you might be interested in the example. We are describing the two methods to perform the impulse response and instead of making two different programs, we are merging them into one. Suppose we want to perform the impulse response operation with the equation given below:

½(y[n]-⅓[y-1]+2/7[y-2]+1/7[y-3]=(x[t]+x[x-1]+x[x-2])/6

Have a look at the program and if it confusing for you at the moment, do not worry, we are going to discuss it in just a bit. 

Code:

fs=25;

t=0:1/fs:1;

c=(t==0)

num=1/3*ones(1,3)

den=[1/2 -1/3 2/7 1/7]

y1=filter(num,den,c)

subplot(211)

stem(t,y1)

xlabel('Using filter method /The Engineering Projects.com')

ylabel('Amplitude')

grid on

y2=impz(num,den,length(t),fs)

subplot(212)

stem(t,y2)

xlabel('Using impulse Function /The Engineering Projects.com')

ylabel('Amplitude')

grid on

Output:

Filter (b,a,x) function in MATLAB

The function of a filter is used to apply the digital filters to the equation with the values that are stored in the num and den. We all know that when dealing with the equations representing a  signal, the ideal format is the one in which the values of the variable y are on one side of the equation and the values of the x variable are on the other side of the equation. So keep this point in mind and look at the representation of the signal. The syntax of this function is given next:

d= filter(b, a,x)

Where:

d= variable in which the result is stored

a = values with the x

b = values with the y

c = time

Impulse Response Function in MATLAB

There is a built-in function in MATLAB to perform the impulse function, and you do not have to do much work to perform it. It will be clear with the help of the following syntax:

impx(b,a, l, f)

Where:

b=values with y

a = values with x

l= length of the time duration

f=frequency of the signal

We have to declare the variables first and then just use them in the formula. We have used this formula in the code, and you will get the concept of working when you will learn the flow of this code. So let’s try to understand the whole code.

  • In the first part, we are providing the frequency with which we want to produce the output.

  • The time here is from 0 to 1, and the interval is the inverse of the frequency that we specify. We all know that frequency is the inverse of time.

  • The equation is presented as a numerator and a denominator. 

  • In the first part, we are using the method of filtering. 

  • In the second part of the code, the built-in impulse function is used and here we have to specify the length of the x that depends upon the time period of the signal that is specified by us in the code. 

  • After applying the values in the function, just use the stem function and the results are here in front of you. 


You can compare the results in the code. Both methods produce the same output, and it is now totally up to you which type of method you prefer to solve your impulse response problems. Your homework is to look at the numerical values that are present in the command window and the workspace area to get the concept of the graph represented. 

The Output of Impulse Response in MATLAB

Now moving towards an interesting concept. Keeping this in mind, we can reverse the whole procedure easy to get the output of the system. At the start of this lecture, we said that by the convolution of impulse response and the input, we get the output. Let's look at this statement in action with the help of this code.

Code:

fs=100;

f=5;

t=0:1/fs:1;

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

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

nx=n+x;

num=1/3*ones(1,3)

den=[1/2 -1/3 2/7 1/7]

imp=impz(num,den)

subplot(211)

stem(t,nx)

xlabel('Input /The Engineering Projects.com')

ylabel('Amplitude')

grid on

y=conv(nx,imp,'same')

subplot(212)

stem(t,y)

xlabel('Output /The Engineering Projects.com')

ylabel('Amplitude')

grid on

Output:

Isn’t it interesting? We have used the same equation and we can get the required results by using some different functions of MATLAB. We are going to introduce some functions used in this code one after the other, and after that, we’ll discuss the code.

Random Function in MATLAB

As the name of the function suggests, the results themselves. You can see it is used to choose any random number between the two that will be specified by us. The syntax of this function is:

rand(x,y)

Where:

x= starting limit

y = ending limit

So, you just have to provide two numbers and this random function will choose any number between those limits and provide you with the random number. Keep in mind, that these are not the chosen numbers by the compiler but the limit of the quantity of the random numbers. It helps a lot in many systems and calculations where we want different results every time we run the code.

The keyword “Same” in MATLAB

This is a different kind of work that we have done in this code, and it will be new to you because we have not used it before in this series. While performing the operation of convolution, we require an equal length of both of the signals. If we do not do so, we’ll get an error because we know that convolution is the procedure in which two signals are overlapped with each other in such a way that we get the third signal. So, we just used the word “same” in the formula of convolution to get the same length of these signals. 

Understanding the Code for Output of Impulse Response

  • First of all, we are going to provide two types of frequencies. One is for the time period and the other is used to provide the equation of input in which we are using the cosine function. 

  • We want to add noise to the signal. So here, we have specified a signal that is represented by the variable n. This has an upper limit of 0.1 and a lower limit of -0.1 (the difference between both of these is the plus sign). So in this equation, we are specifying two things:

The limits of the number from which the values of noise signals will be picked and the number of digits that will be picked by the compiler as the length of the noise signal.

  • Do not be confused between these two types of limits. By using these kinds of conditions, we will always have a different type of signal with different lengths all the time when we run the code. 

  • Once the noise signal is generated, we’ll have the input signal containing both parts, the noise signal, and the cosine function. 

  • We have used the same equation that we used in the impulse function, so the impulse is the same as in the previous code. 

  • The input signal is shown with the help of a subplot and stem to represent the input signal. 

  • In the second half of this code, we are convoluting the noise and the input signal by using the same length of both these signals. 

  • The result is then stored in the variable y, which is represented in discrete values by using the stem function. 

So, it was an interesting lecture in which we learned the impulse response in detail, and with the help of codes in MATLAB, we studied the input, output, and impulse generation in an easy way.

Properties of Fourier Transform in MATLAB

Hey, pupils welcome to the next session about the Fourier transform. Till now, we have learned about the basics of Fourier transform. It is always better to understand all the properties of a mathematical tool to understand its workings and characteristics. You will observe that most of its properties are similar to the topics that we have discussed before, and the reason is, that all of them are transforms, and the core objective of these transforms is the same. We have learned about the simple and easy discussion of the Fourier Transform, but when dealing with complex problems, it involves the usage of different properties so that we do not have to repeat the calculations all the time to get the required results. Have a look at what you are going to learn today:

  • What are the basic properties of the Fourier transform?

  • How can you ding the inverse Fourier Transform?

  • How to implement inverse Fourier transform in MATLAB?

  • What are some applications of the Fourier transform?

So let’s start with the properties of this transform. 

Linearity

First of all, the Fourier transform is linear. It means if we have two expressions of the Fourier transform that are denoted by G(t) and H(t) then combining them with the help of mathematical operations such as multiplication or addition results in an expression that is also linear. 

Duality 

It is an attractive property of the Fourier transform that says when a discrete-time signal is transformed into the frequency domain, then it can be regenerated into its time domain form by multiplying it with a negative factor, but in this way, we will get the reverse of the original signal.

Modulation of the Fourier Transform

The modulation of the Fourier transform occurs only when both the signals, that are to be modulated are in the form of functions of time. 

Time Shifting Property of Fourier Transform

This property of Fourier transform says that if we are applying it on a function g(t-a) then it has the same proportional effect as g(t) if a is the real number. If you have a clear idea of the procedure of time scaling, it will be easy for you to understand the situation here. 

Parseval’s Theorem of Fourier Transform

This theorem is related especially to the Fourier transform. It says that the sum of the squares of a function x(t) is equal to the Fourier transform of the function x(t). 

It is an important theorem because once we have this clear theorem, we do not have to calculate the square of the whole series of Fourier transforms. So, it becomes easy to deal with these quantities with the help of this theorem.

Scaling in Fourier Transform

Scaling of the signal is the process in which there is a change in the independent variable or the data features in the form of a range of the signal. This property says that if the values of the signals on the x-axis in the time domain are inversely proportional to the values on the x-axis when we convert them into the frequency domain. In other words, the more stretched a signal is in the time domain means less stretched and a taller signal in the frequency domain and vice versa.

If

f(t) = F(w) 

Then,

f(at) = (1/|a|)F(w/a)

Convolution in Fourier Transform

Convolution is the process in which two signals are overlapped on each other in such a way that we obtain a third signal that is different from the first two. When we talk about the convolution of the two signals, we get results that are equal to the convolution of the same function in the Fourier transform. 

Mathematically,

If 

f(t) = F(w) and g(t) = G(w)

Then, 

f(t)*g(t) = F(w)*G(w)

In this way, it becomes easy to predict the result if we know the value of one function and are interested in knowing the other.

Differentiation of the Fourier Transform

We all know the procedure of differentiation, and when we are differentiating the Fourier transform, we may get confused about following the rules of both these procedures. So, with the help of using this property, you can easily guess the results. This property says that:

If

f(t) = F(w) 

Then,

 f'(t) = jwF(w)

Where j is the variable and w is the function based on which the differentiation is occurring.

Inverse Discrete Fourier Transform or DFT

So far, we have learned how DFT is used to obtain the signal in the frequency domain. But what if we want the inverse results? What if we want our original signal back? Well, it is the requirement of a large number of applications, and then the inverse Discrete Fourier Transform is used. It is not a new concept to use the inverse methods, as we have also read it when we were discussing the previous transforms. 

To perform the inverse method, we just have to simply follow the formula given below:

All the other variables are the same. We just have to remember the formula and we are good to go. 

Code:

clc;

x=input('Enter the Input')

N=length(x);

m=zeros(1,N)

for n=0:N-1

    for k=0:N-1

        m(n+1) = m (n+1)+((1/N)*(x(k+1)*exp(((i)*2*pi*k*n)/N)));

    end

end

disp('m=')

disp(m)

Output:

Let’s understand this code. There are a few things that we have used for the very first time in this series, and therefore, I want to describe them all. 

clc; in MATLAB

It is a very common and useful command that you will often see in the first place of almost every MATLAB code. The purpose of using this line is to clear all the data that you are looking at on the screen of your display window. 

There is a window just below the working area of MATLAB called the “command window." main reason why we are discussing this line here is that we have not used the input function till now in this series, and therefore, I do not feel any need for this clear screen command here. This will be more clear when you learn about input functions. 

Input Function in MATLAB

In MATLAB, when we want to input the values of a particular quantity on our own, we use the following function:

input(x)

Where x is the quantity that we want to have the input of. Moreover, you can also use it to provide the statement on your own (as we have done in our program), but the statement should be enclosed in inverted commas if you want to print the statement as it is.

disp(x) in MATLAB

This is another function that we have used for the first time in this series. Well, this is the display function, and it is used to display the result or quantity that we want. Here in this code, for instance, we wanted to show the value of the result that we have stored in “m”. Therefore, we first displayed the m in inverted commas so that it was printed as it was, and after that, when we used the same function without the inverted commas, we got the value of the m that was stored before. 

For Loop in MATLAB

Loops are used in many programming languages, and if you have the basic concepts of programming languages, then you must know that “for loops” in MATLAB are used when we want that compiler to stay at a particular line and repeat the same line until a particular condition is fulfilled. 

In our case, we started the first loop when m=0 and it stayed at that particular line till the value was one less than N. The same case was with the second loop. Once the condition was met, the compiler moved toward the next line. 

The syntax of the for loop in MATLAB is:

for x:y

Statement

end

Where x is the starting point of the for loop and y is the ending point of the for loop, both of these are specified by the programmer, and a statement is a calculation that we want to perform again and again.

Explaining the Code of IDFT in MATLAB

  • Clc clears the screen of the command prompt in case you are using the code for the second or more time. 

  • The input function displays a message to the user that input is required from him/her. 

  • The input by the user is stored in the variable x. 

  • Now, we are introducing another variable, m, that stores the result calculated by the length function. It is the total number of values provided by the user. 

  • Here, we are calculating the number of zeros between the number 1 and the length of the input by the user that was stored in N. 

  • The interesting part starts here. We are using two for loops, which means we are nesting the loops. The condition of both of them has been discussed before. The formula that we have hardcoded inside these loops is used till the conditions provided by us are met. To perform the functions on the series of signals, loops are used in this way so that we do not have to write the same lines again and again.

  • In the end, when we have the results stored in the variable m, we just display it with the label m, and our program is completed.

Applications of the Fourier Transform

As we have mentioned that Fourier transform has great importance in many fields of education and science and therefore, great work has been done by using this technique. Some important fields and applications of the Fourier transform are discussed in this section. 

Fourier Transform in Medical Engineering

In medical engineering, where we get complex and hard results. The Fourier transform is an old technique and therefore, it is used in the field of medical engineering for a long time. The impulse response and delicate results in the form of the signal are fed into the compilers where these signals are tested and examined deeply in a better way. 

Fourier Transform in Mobile phones

Here is an interesting application of the Fourier transform. We all know that cell phones work with the help of signals and therefore, there is a lot of work that can be done by using the Fourier transform. If you are wondering how the Fourier transform is performed in the cell phone then you are at the right point. Actually, while making, testing, and designing cell phones and other such products, the rules and calculations of Fourier transform are used widely because of its precise result and research. 

Fourier Transform in Optics

As we discussed from the beginning, the Fourier transform works great with the signals. The optic is the field that works in the waves and delicate signals and therefore, the Fourier transform is used to sum all the results in a great way and to find the results according to the need. Most of the process occurs in the optics when the light or other rays are merged into one point, and with the collaboration of other techniques, the Fourier transform works great to make all the procedures easy and accurate. Moreover, the Fourier transform is also useful for the smoothness of the signals and filtering of the results as well.

So, today we learned interesting information about the Fourier transform, and now we can say that we have all the basic information about the Fourier transform. We have seen the properties of the Fourier transform and also learned about the inverse Fourier transform, along with the MATLAB code for a perfect concept. The concept of the for loop, clc, and input method was new to us. In the next session, we are going to talk about the comparison of all these transformations. So be with us.

How to Install PCBWay Plugin for FreeCAD PCB Software?

Hi Guys! Hope you’re well today. I welcome you on board. In this post, I’ll walk you through How to Install PCBWay Plugin for FreeCAD PCB Software. 

Before we move further and help you with the installation of the plugin, let’s get a brief introduction to the FreeCAD software. 

FreeCAD is a free and open-source parametric 3D modeler used to design real-life objects. With parametric modeling, you can easily modify your design and change its parameters. The tool is mainly used in mechanical engineering for product design and also proves to be handy in electrical engineering for electronic board designs. It supports Windows, Linux and macOS operating systems. Python programming language is primarily used to extend the overall functioning of the software. 

Hope you’ve got an idea of what FreeCAD is all about. Let’s get further and discuss How to Install the PCBWay Plugin for FreeCAD PCB Software. 

How to Install PCBWay Plugin for FreeCAD PCB Software?

FreeCAD allows you to design PCB boards and send the final layout to PCBWay for instant production. 

First, we download and install the FreeCAD software then we’ll cover how to install the plugin. To download the software, go to the FreeCAD website and click the “Download Now” option as follows.

  • Once you click it, it will return the following page where you can pick the operating system.

  • Select the operating system to download the software. For instance, if you have Windows, click the Windows 64-Bit Installer and the downloading will start.
  • Once it is downloaded, right-click and open the downloaded file to install it, as follows.

  • Click the “next” option to continue to install the software, as shown in the figure below.

  • When you click next, the following image will appear, again click “next” as follows.

  • Once the installation is completed, the following page will appear. Click “Finish” 

  • Now start the software. Go to “Tools – Addon Manager” as shown in the image below.

  • In the “Show Addons Containing” select “All”. And scroll down to find the PCBWay plugin as shown in the figure below.

When you click the “PCBWay” the plugin will be installed on the software. Now you can make PCB designs on the FreeCAD and send it right away to the PCBWay manufacturer for the production of your required electronic board. 

About the Company PCBWay

PCBWay is the largest PCB manufacturer in China. It’s a one stop shop for your DIY projects, custom test equipment and the advanced electronic projects. Apart from manufacturing regular PCBs including single layer, double layer and multi-layer boards, they also offer other services like flexible PCBs, SMD stencils, advanced PCBs and PCBA (printed circuit board assembly).

User-Friendly Website

Website is easy to navigate and runs well on both laptop and mobile screen. You can instantly get the quote and submit your Gerber files on the website. When you submit the order, you can see all the information about your orders on the dashboard, including the order status, progress of your boards and delivery updates.

PCBA Service

First you need to put the parameters on the Instant Quote appearing on the website above the fold. Then you’ll see the following page. If you pick PCB assembly service, you are offered with three flexible options to choose from. If you pick “Turnkey” option, it means PCBWay will supply the parts. And if you pick “Kitted or Consigned” it means the customers will supply the parts. And the third option is a mix of both: some parts will be supplied by the customers and the remaining parts will be sourced by the company. 

Great Customer Service 

Customer service is great. All the representatives are responsive, highly professionals and well aware of the technical details of the electronic boards. Plus, if you find any defective piece, you can instantly get in touch with their aftersales team and they will guide you on the best possible solution. And if you find the dedicated service representative is not helpful, you can request the new agent by sending your request to service@pcbway.com or feedback@pcbway.com

PCB Panels

If you want electronic boards in large numbers for your projects, then PCB panel is the option. PCBWay also offer PCB panel services where a single PCB design is replicated multiple times on a large board called panel. Individual boards are then depanelized from the main boards and are ready to be used in the project.

Once you click the Instant Quote from the main page, you’ll see the following page with the PCB panel option.

99% Delivery Rate

They pride themselves to maintain a 99% delivery rate. Some people complained about the late delivery. But know that delivery time mainly depends on the shipment service you choose and it’s not in their control once the product leaves the fabrication house. However, they make sure the product leaves the facility within the due date. 

That’s all for today. Hope you find this article helpful. If you have any questions about installing the PCBWay plugin, you can ask me in the section below. I’d love to help you the best way I can. Thank you for reading the article.

How to Build a Raspberry Pi FM Transmitter

Throughout our lives, we've relied on Radio and tv stations to keep us engaged. While we're on the subject of contradictions, it's also fair to say that these Stations can become tedious at times due to the RJ rambling on about nothing or annoying advertisements, and this may have left you wondering why you can't own a Radio station to broadcast your data over short distances.

Almost any electronics technician uses coils and other hardware to make an FM transmitter, although the tuning process is time-consuming and difficult. Setting up your FM station and going live in your neighborhood shouldn't take more than 30 minutes using an RPi. If you use the right antenna, you must be able to transmit to your school or community within 50 meters. Wow, that's interesting! So, let's get started right now.

Caution: This project is an education project and should not be abused in any way that might harm or inconvenience anyone. Interfering with neighboring FM frequencies is illegal, so please exercise caution when using this feature. In the event of any mishaps, we take no responsibility for them.

Where To Buy?
No.ComponentsDistributorLink To Buy
1Jumper WiresAmazonBuy Now
2Raspberry Pi 4AmazonBuy Now

Components

  • Raspberry Pi

  • Internet connection

  • Microphone

  • An enthusiastic RJ

Pre-requisites

Your RPi should already be running an os and be able to establish a network connection. If you haven't done so already, go through the instructions on how to use a raspberry pi.

A virtual server such as VNC, or a putty terminal window, is assumed to be accessible to you at all times. For the sake of this tutorial, we will run the program on RPi using the putty terminal session.

Frequency Modulation: What is it?

A method or procedure known as FM involves changing the carrier signal frequencies to match the frequencies of the modulated signal to encode information on a specific signal. Since data must be conveyed after being transformed into an electrical signal, a modulation signal is simply that.

A carrier's signal is transformed by an original signal in the modulation technique, which uses a methodology similar to amplitude modulation. On the other hand, FM maintains or maintains a steady signal loudness.

Why is FM necessary?

Fm is primarily used to decrease noise as well as the size of antennae, respectively. We know that a bigger antenna is required to send reduced frequency signals, whereas a smaller one is necessary to broadcast high-frequency signals.

Therefore, the sound signals are transformed into high-frequency radio waves and broadcast using the FM technique. Once more, the demodulation circuit on the receiver's side converts the high-frequency radio transmission frequency into the original understandable audio signal.

There is little interference since different signals are transmitted over a specific channel using separate wavelengths. So many folks can converse simultaneously and unhindered in a large metropolis.

FM transmission using coils

The construction of a long-range FM transmitter has long been on my bucket list of cool things. I've been so intrigued by some of the transmitter's uses, particularly since I was a kid, and spent much of my time fantasizing about how awesome it would be to have a few of the technology and technologies used in espionage movies. So lately, while reviewing one of my residence automation projects by using RPi and the motion package library, I felt it would be cool to add audio to the deliverable and stream live, so in addition to the multimedia feedback provided by the RPi, I could also get sound feedback out from area under monitoring. Even while this FM transmitter would not let me hear distantly (a range exceeding 10 kilometers), it will at least enable me to maintain an "ear" on events while I am about the property; then, after building it, I would have accomplished a few of the objectives that the younger me had set out to attain. It took me a few days ago, but I eventually got the motivation to make one, and I'll show you how to do it in today's post.

To avoid violation of policies of some countries, this experiment is being conducted solely for educational and scientific purposes. Keep the FM transmission at a low range and make sure it is built in compliance with applicable laws of one’s nation and therefore does not induce a disruption to others. This is essential. For any mishaps, I take no responsibility.

How do FM transmitters work

Using the concepts of the modulated signal, an FM transmitter can transmit the audio it receives from its input. Most FM transmitters are constructed in the manner depicted in the diagram below.

An amplification is frequently included in the transmitters because the transmission power of audio input is relatively low. This is done by utilizing an oscillator component to produce the carrier signal, which is then combined with an audio stream to generate a modulated signal that can be transmitted. When it comes to communicating, the low-impedance modulation signal is fed via a power amplifier to get to the antenna.

FM broadcast circuit

The electrical component should be connected as illustrated in the following FM transmitter diagram.

In this photo, you can see the prototype version of the FM radio transmitter.

The first transistors amplify the mic's output signals to a level suitable for transmission because the mic's output waveform is typically modest. In addition to amplification, the transmitter must also modulate. After that, the boosted audio signal is combined with the desired transmission carrier frequency to create a final signal. Because there is no visible output to identify the precise frequency where the transmitters are working, you may need to modify the FM transceiver radio well within the frequency range stated above to get the transmission frequency. This carrier signal can be differed using a 20pF capacitor attached to the inductor. The traditional spectral range of this specific design would be between 88MegaHeartz and 108MegaHertz. Once the carrier signal has modulated the audio signal, it is sent to the antenna, where it is received.

The resistors and capacitors used aren't set in stone, so you can experiment with them to get the best performance out of the transmitters.

Several other uses for this design aren't mentioned above, such as baby monitors or school address systems. Before constructing any of those practical items, please remember to check your local laws.

How Pi 4 works as a transmitter 

How can RPi, a board designed to serve as a development platform for microprocessors, do all of this? What if I don't need extra hardware to use the board as an FM station?

To prevent interference problems, each CPU will have a synchronized digital device. A signal known as a Spread-spectrum system clock, or SSCS is responsible for this Electromagnetic interference suppression. This frequency ranges from 1 MegaHeartz to 250 MegaHeartz, which fortunately fits well within the FM spectrum. We can make the Pi become an FM broadcaster by developing some code that uses the spread-spectrum clock frequency to modulate the frequencies. The Rpi Pi's GPIO pin 4 is where the frequency modulation will be sent. To use this pin as an antenna, we need a piece of standard wire attached to it no longer than 20 cm in length.

Getting the pi 4 readies for programming

Otherwise, read on for instructions on accessing your pi through the Command window if you haven't already done so. Boot Raspberry Pi with an HDMI connection to a display and an input device once you've installed a new operating system.

Link your Raspberry to the network by searching for a network option on the Raspberry desktop. Then go to the raspberry menu, click raspberry settings, and activate the SSH connection afterward. On your Windows or MAC computer, reconnect your computer to the same network as your Raspberry Pi so that both devices may communicate with each other on the local area network. You're ready to begin now that you've had Putty installed and running. Enter the Raspberry Pi's Internet protocol address and press enter. If you don't know your PI's Internet address, go to the admin side of your router and see if it's 192.168.43.XXX or something similar. An open command prompt will appear and ask for your login and passcode if all is done correctly. The default login and passcode are pi and Raspberry, respectively. Press Enter to see the next screen after entering it.

Convert Pi 4 into an FM station

GitHub provides the code needed to turn the Raspberry into a radio station. This page can be cloned directly into Raspberry; the application can be compiled and launched if you understand how to do so. Just follow the instructions below, and you'll be transmitting your audio files in no time.

Step 1:

Set up a new directory for our software files and put them there. Create a new guide by typing 'mkdir RPI FM' inside the command prompt, and then enter the folder using the word 'cd.'

mkdir PI_FM

cd PI_FM

Step 2: 

We must now copy the application from GitHub and place it in the folder we just made. Since we've previously moved inside the folder, we can run the following command below to complete the task.

sudo git clone https://github.com/markondej/fm_transmitter

Step 3:

We'll need a C compiler and other tools to run the C program we just acquired. GCC and G++ are the tools for this code, and the software for compiling them is termed make. To obtain compilers, enter the code shown below. Once the file is downloaded, your display will appear like the one below.

sudo apt-get install GCC g++ make

Step 4:

Compiling the code is now a cinch. You can do this by going into the folder using the change directory 'cd' FM transmitter and then compiling the script with root user 'sudo make .'The screen below should appear once your code has been successfully compiled.

cd fm_transmitter

sudo make

Step 5:

Launching the system is the last step. The intensity for which we would like to transmit, and the identity of the audio recording we would like to play must be specified when the program is launched. Star wars.wav is the default sound file that will be retrieved together with the code. We'll play the Movie Theme song at a 100megahertz frequency for testing purposes. The launch line's syntactic structure is:

sudo ./fm_transmitter [-f frequency] [-r] filename

The channel will be 100 MegaHeartz long because we need to play the movie file at that frequency.

sudo ./fm_transmitter -f 100  -r star_wars.wav

Test the Pi 4 FM transmitter

After you have started the application and you see the playback message as seen above, we may link an antenna to a Gpio 4 of Raspberry, I use a standard connecting wire, and it works perfectly for me.

Take a Radio, then set it to 100MegaHeartz channel, and you'll be able to listen to the movie music being aired. After making sure it works, you may switch out the movie theme with any other music or audio recording you choose and broadcast it with the same instructions as in step 5.

Transmitting live sound

While playing pre-recorded audio clips is entertaining, using this Pi 4 FM broadcast live audio would be much more enticing. With the help of the same tool, this is also possible. Just plug a mic into the Raspberry Pi's USB connection and modify the startup command-line interface. For additional information on this, please visit the GitHub homepage. Use the comment section of the forums if you run into any issues getting this to function.

Applications of FM

When it comes to frequency modulation uses, radio transmission dominates the list. Due to its higher signal-to-noise ratios, it provides a significant advantage in a radio broadcast. That is, there is little radio wave interference as a result. This is the fundamental justification for why so most radio stations choose to transmit music via FM.

Furthermore, many of its applications can be found in telematics, geophysical prospecting, EEG, various radio technologies, music creation, and devices used for broadcasting video. Fm offers a significant benefit over all other modulations in a radio broadcast. It will resist radio wave disruptions far better than an equally powerful modulation amplitude (AM) signal because it has a higher signal-to-noise ratio. The majority of music is aired through FM radio for this important reason.

  • Radio transmission frequently uses pulse modulation technology. Each radio broadcast station has its frequency range, and all broadcaster station signals are sent over the same transmission system. We can adjust the Radio's tuning to link it to a specific radio channel.

  • Our pc connections also employ pulse modulation technology.

  • The pulse modulation method is employed in magnetic storage tape recording systems.

  • Radio Detecting And Range (RADAR) systems employ the pulse modulation approach.

  • Multimedia content communications, including voice/video broadcasts, also use pulse modulation technology. Most of the time, the sound is delivered over FM, and occasionally, the film is as well.

  • The modulated signal generates an electrical impulse for usage in electronic instruments.

  • The monitoring system also makes use of FM technology.

  • Audio is synthesized by using the FM technology in pc sound adapters.

  • Military communication systems like Walkie-Talkies employ pulse modulation technology.

  • Additionally, Bluetooth and Zigbee communications technology utilize the FM method.

  • The Broadcasting method is also employed in ambulance systems.

  • The satellite radio technology uses FM technology.

  • Due to its low electronic noise, this FM method is employed in two-way radio transmission.

Benefits of FM

  • Low noise distortion

  • A smaller antenna is needed for pulse modulation equipment.

  • The pulse modulation platform's can be built to consume little power. This is a significant benefit of the modulation technique.

  • The pulse modulation process is more efficient because the signal's amplitude is always consistent.

Drawbacks of FM

  • The frequencies modulation circuit has many intricate parts.

  • A carrier wave is required for the frequency modulation process.

  • Amplification modulation is appropriate for long transmission lines, while FM is not.

Conclusion

In this article, we have learned how to create a radio station using a raspberry pi 4 with a few very simple steps. We have broadcasted a Star Wars movie theme through this system, and now you can try many other forms of data to broadcast, including video and live sound using a mic to get more familiar with the system. The next tutorial will teach us how to build a temperature log.

Sequencer Output Instruction in PLC Ladder Logic Programming

Hi friends, today we are going to learn a good technique to run multi outputs in sequence. In another word, when we have some output that is repeatedly run in sequence. In the normal or conventional technique of programming we deal with them individually or one by one which takes more effort in programming and much space of memory. So instead we can use a new technique to trigger these outputs in sequence using one instruction which will save the effort of programming and space of memory. In this article, we are going to introduce how to implement sequencer output instruction. And practice some examples with the simulator as usual. Before starting the article, we need to mention that, some controllers like Allen Bradley have sequencer output instruction and some has not like Siemens. So we are going to give one example for each case showing how to code the equivalent to the sequencer output instruction in the PLCs that does not support this instruction.

Sequencer output instruction 

Figure one shows the block diagram of the process. The instruction takes the input data from the file, array, and data block and sequentially relays it to the outputs to trigger them sequentially.

Figure 2 shows the block of the sequencer output instruction showing input and output parameters. The file parameter is the first input parameter showing the address of the reference sequencer file. In addition, the mask input is to receive the address of the mask or the data block of which the instruction will move the data sequentially before relaying it to the output. Furthermore, the dest parameter is an output parameter that shows the address of the output to which the sequence bits will be applied. And the control parameter is the storage words for the status of the instruction, the file length, and the position of the pointer in the data file or array. Also, the length parameter holds the number of steps to move in the data file to the output destination sequentially. And position parameter holds the location of the pointer in the data file.


Block description and example of the sequencer output instruction

Figure 3 shows an instance of sequencer output instruction QSO. The QSO instruction steply moves through the input data file or array or data block and transfers sequentially the data bits from the data file to the output (destination word) through the mask word. The status of the instruction can be shown in the DONE (DN) bit. You should notice my friends that after the data transition is done the position is reset to the initial position or the first step.

Ladder Logic Example

Now guys, let us move to the ladder logic coding. So how does that sequencer output instruction work in ladder logic? Well!  Figure 4 shows a complete example of QSO instruction that is used in Allen Bradley to handle the sequencer output process, it shows one rung that has a start and stops push buttons from left to right at address I:0/0 and I:0/1 respectively to control the starting and stopping of the sequencer output processing. Next, you can see input I:0/2 which is used as a sequencer process flag to switch on or off the sequencer process. So, if the start PB is requested when no emergency stop and the sequencer on input is ON, the QSO is enabled and the data at address #B3:0 will be moved to dest at address O0:0 though the mask word at address 000Fh starting from position 0 with length 4.

Figure 5 shows the data file that the QSO uses to transfer sequence data bits to output. It shows the bits B3:0, B3:1, B3:2 & B3:3 are set to 1 for reference. So, when the sequencer ON input is set to high (I:0/2). The output Q:0/1 will be turned on based on the data in the data file shown in fig. 5. In that case, the length is 4 and the position is 1.

And when the sequencer flag I:0/2 is switched on next time, output O:0/2 will be switched ON. In that case, the length is 4 and the position is 2 as shown in Fig. 6.

In the third time, the sequencer flag is turned ON, the output O:0/3 will be turned ON and the length and position are updated to 4 and 3 respectively as shown in Fig. 7.

When it comes to the fourth time of switching the sequencer flag I:o/2, the output O:0/4 will be turned high and the position will be at 4 and length is 4 as shown in fig.8. At that time, the process is reset and position reset to 1.

The previous example shows how it is simple to control a bunch of outputs that are required to run in sequence with only one rung of the ladder program and using only one instruction which is QSO in Allen Bradley. This merit helps to save the memory space and time and efforts of programming and troubleshooting as well because the program will be shorter and more readable. However, still, some brands have not supported such instructions even the big names like siemens. That can not be counted as limitations but they are banking on there being a way to implement such logic. So, it is very beneficial for you guys to go implement together a piece of code (ladder logic) that is equivalent to such instruction for performing the function of sequencer output instruction in Siemens S7-1200 using our simulator. 

Ladder logic code for SQ0

As you guys see the sequencer output instruction is nothing but shifting the height value from right to left bit or right to left or even rotated shift for continuous operation. That drives our thinking to use the shift instructions in Siemens to perform this sequencer output instruction. 

Figure 9 shows the rungs of a ladder PLC simple program that implements the sequencer output process. See guys how lengthy the logic we have to code to do the same function of single instruction QSO in Allen Bradley. Again, that is a drawback or limitation thing but the program is more lengthy and takes more effort and also memory it is consuming that way. Moving to the logic listed in Fig. 9, the first thing is using a rotated shift instruction that shifts through the data block bit by bit and applies to the output QW0. At the same time increment instruction is used to move through the data. Also, one on delay timer is used to do some delay to show up the sequencing process of activating the output sequentially. And the end, a comparison instruction has been used to check if the pointer or the position reached the last output coil to reset to the first position and so on.

Simulating the sequencer output ladder code

Figure 10 shows the simulation of the sequencer output ladder code before activating the processes by using M0.0, it shows the position is at 1 and the output QW0 is all zeros. So let us activate the sequencer output process by set M0.0 to high and see the output.

Figure 11 shows the process after activating the sequencer program and starting to switch on outputs sequentially. The figure shows the process reached the sixth output coil and the position set to 7 to point at the next output. The process continues to tell reach the last one and then the position set the first step.

What’s Next???

I am glad to have you guys following tell that point and I hope you see the importance of the sequencer output technique in reducing the effort of programming and saving memory. Next time will take a tour with the bitwise logic operator and how they are utilized and how they work in the ladder program with given examples and for sure simulation to practice their usage. So let’s meet then and be ready.


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.

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.

    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