top of page
Writer's picturelms editor

How to Use Transfer Function Block in MATLAB Simulink

How to Use Transfer Function Block in MATLAB Simulink


Introduction

We will learn how to use the transfer function block in MATLAB Simulink. We'll start by defining a given transfer function and then implement it in Simulink. Our transfer function is G(s) = (s + 3) / (s² + 2s).

Adding Transfer Function Block

  1. Search for the Transfer Function Block:

  • In Simulink, search for the 'Transfer Fcn' block.

  • Drag and drop the block into your model workspace.

  1. Set Up the Transfer Function:

  • We need to implement the transfer function G(s) = (s + 3) / (s² + 2s).

  • Double-click the 'Transfer Fcn' block to open its parameters window.

  • Enter the numerator coefficients [1 3] (representing s + 3).

  • Enter the denominator coefficients [1 2 0] (representing s² + 2s).

Understanding Transfer Function Parameters

  1. Numerator and Denominator Coefficients:

  • The numerator coefficients represent the polynomial in the numerator of the transfer function.

  • The denominator coefficients represent the polynomial in the denominator of the transfer function.

  1. Order of Polynomials:

  • Ensure that the order of the numerator polynomial is less than or equal to the order of the denominator polynomial. For example, for a valid transfer function, G(s) = (s + 3) / (s² + 2s), the numerator has order 1 and the denominator has order 2.

  1. Example of Invalid Transfer Function:

  • If you set the numerator coefficients to [1 1 1] and the denominator to [1 1], the model will show an error because the numerator's order (2) is greater than the denominator's order (1).

Implementing the Transfer Function

  1. Define the Coefficients:

  • For our transfer function G(s) = (s + 3) / (s² + 2s):

  • Numerator coefficients: [1 3]

  • Denominator coefficients: [1 2 0]

  • Enter these values in the respective fields of the 'Transfer Fcn' block.

  1. Simulating the Transfer Function:

  • Add a 'Step' input block to provide input to the transfer function.

  • Connect a 'Scope' block to measure and visualize the output.

  • Run the simulation to observe the system response. For a step input of 1, the output will increase linearly over time.

Alternative Implementation Methods

  1. Using Separate Blocks:

  • We can implement the same transfer function using different blocks. For instance, G(s) = (s + 3) / (s * (s + 2)) can be split as:

  • A 'Transfer Fcn' block with numerator [1 3] and denominator [1 2].

  • An 'Integrator' block to represent the 1/s term.

  • Connect these blocks appropriately to replicate the transfer function.

  1. Simulate and Compare:

  • Provide the same input to both implementations and compare the outputs using the 'Scope' block.

  • Run the simulation to ensure both methods produce identical outputs, confirming the alternative implementation's correctness.

Conclusion

In this tutorial, we demonstrated how to use the transfer function block in MATLAB Simulink. We explored defining the transfer function, setting up its parameters, and simulating the system response. Additionally, we discussed alternative methods to implement the transfer function using different Simulink blocks. This flexibility allows for various approaches to modeling and simulating dynamic systems in Simulink.

20 views0 comments

Commentaires


bottom of page