in this tutorial we will learn transfer function and bode plot in matlab.Bode Plot is the commonly known analysis and design technique employed in the design of the Linear Time Invariant (LTI) system. Bode Plot compliance the complete information about the frequency response of the Linear Time Invariant System but do so in the graphical domain. That is the Bode plot consists of the Bode Magnitude Plot of the LTI system and the Bode Phase Plot of the system. Bode Magnitude Plot gives the information about the relationship between the system input frequency and the magnitude of the output of the system and on the other hand the magnitude phase plot contains the information of the variation of the phase of the output with respect to the corresponding variation in the system input signal.

#### Bode plot in MATLAB:

The Bode Plot can be considered as the visualization of the frequency response of the System as the frequency response of the system contains the knowledge about the variation of the output magnitude and phase with respect to the range of the frequencies of the input signal. The frequency response of the system is usually represented in terms of the complex frequency variable. The general representation of the frequency response of the system is shown in the figure below:

As shown in the figure above the frequency response of the system can be thought of as the transfer function of the system in the frequency domain. The equation above shows the relationship between the input and the output of the system in terms of the frequency variable. It can be noted that the frequency response which is basically the transfer function can be obtained by taking the Laplace transform of the time domain representation of the system or by taking the Fourier transform of the time domain representation of the system.

#### Transfer Function in MATLAB:

As noted previously that the transfer function represents the input and output of the system in terms of the complex frequency variable so that the transfer function can give the complete information about the frequency response of the system. It is important that we have the transfer function of the system in order to analyze the system in the frequency domain. There are various techniques with the help of which we can obtain the transfer function of the LTI system one is the Laplace transform and the other Fourier Transform. There is not much difference between the Laplace transform and the Fourier transform. To be precise the Laplace transform is the general representation of the Fourier Transform. The Laplace transform converts the time domain representation of the system in the frequency domain in which the variation of the frequency variable determines the behavior of the overall system.

Keeping in mind the importance of the transfer function there should be some handy way of representing the Transfer Function in MATLAB which is commonly used tool in analysis and design. Let us now discuss the transfer function representation of the system in the MATLAB with the help of some examples.

## Example 1:

The above mentioned transfer function can be represented in the MATLAB as follows:

Example 2:

Now let us consider another example:

The above mentioned transfer function can be represented in the MATLAB as follows:

#### transfer function matlab Example 3:

Now let us consider another example:

The above mentioned transfer function can be represented in the MATLAB as follows:

#### Bode Plots and Transfer Function:

We have already mentioned in the above sections that the Bode Plot is the technique for visualizing the Frequency response of the system and also the transfer function compliance the complete information about the frequency response of the system. The frequency response of the system gives the information about the phase response of the system in correspondence to the varying frequency and the magnitude response of the system corresponding to the frequency range of the input signal. So by plotting the transfer function of the system for the range of frequencies we can have the complete Bode plot.

MATLAB is an important tool for analysis and design of the systems. The procedure for plotting the Bode Plots in MATLAB from the transfer function representation of the system is quite easy and discussed below.

##### Example1:

Let us plot the Bode Plot for each transfer function and in doing so we will see the added functionality that can be achieved from the Bode plot function in MATLAB. Consider the following transfer function:

The Bode plot of the above transfer function can be obtained by following the procedure shown in the following image:

Now ley

##### Example 2:

Now let us plot the Bode plot of the following transfer function:

Suppose that you want to plot the Bode plots of the transfer function of two systems in order to have the comparison between the two. This can be done simply and the procedure is shown in the figure below:

#### Bode plots of the transfer function Example3:

Now let us consider that you have the analysis problem in which you want to obtain the magnitude and phase response of the system in particular frequency range. This can be done simply and the procedure is shown in the following figure:

That is all for now I hope this article would be helpful for you in the nest article I will come up with more interesting educational topics. Till then stay connected, keep reading and enjoy learning.