0
0
SimulinkHow-ToBeginner · 4 min read

How to Use Transfer Function Block in Simulink: Simple Guide

In Simulink, use the Transfer Function block to model linear dynamic systems by specifying numerator and denominator coefficients of the transfer function. Drag the block from the Simulink library, set the coefficients in its parameters, and connect it to your model to simulate system behavior.
📐

Syntax

The Transfer Function block requires two main inputs: the numerator and denominator coefficients of the transfer function. These coefficients define the system's behavior as a ratio of polynomials in the Laplace variable s.

  • Numerator: Vector of coefficients for the numerator polynomial (highest power first).
  • Denominator: Vector of coefficients for the denominator polynomial (highest power first).

Example: For a transfer function \( \frac{2s + 5}{s^2 + 3s + 4} \), numerator is [2 5] and denominator is [1 3 4].

matlab
Numerator = [2 5];
Denominator = [1 3 4];
💻

Example

This example shows how to create a simple Simulink model using the Transfer Function block to simulate the response of \( \frac{1}{s^2 + 2s + 1} \) to a step input.

matlab
open_system(new_system('tf_example'));
add_block('simulink/Sources/Step','tf_example/Step');
add_block('simulink/Continuous/Transfer Fcn','tf_example/TransferFcn');
add_block('simulink/Sinks/Scope','tf_example/Scope');
set_param('tf_example/TransferFcn','Numerator','[1]','Denominator','[1 2 1]');
add_line('tf_example','Step/1','TransferFcn/1');
add_line('tf_example','TransferFcn/1','Scope/1');
sim('tf_example');
Output
A Simulink model named 'tf_example' opens with a Step input connected to a Transfer Function block and a Scope showing the output response to the step input.
⚠️

Common Pitfalls

  • Entering numerator or denominator coefficients in the wrong order (should be highest power first).
  • Leaving denominator empty or zero, which causes simulation errors.
  • Forgetting to connect input and output ports properly in the model.
  • Using transfer functions that are not proper (degree numerator higher than denominator) can cause simulation instability.
matlab
%% Wrong way: numerator and denominator reversed
set_param('tf_example/TransferFcn','Numerator','[1 2 1]','Denominator','[1]');

%% Right way:
set_param('tf_example/TransferFcn','Numerator','[1]','Denominator','[1 2 1]');
📊

Quick Reference

ParameterDescriptionExample
NumeratorCoefficients of numerator polynomial (highest power first)[2 5] for 2s + 5
DenominatorCoefficients of denominator polynomial (highest power first)[1 3 4] for s^2 + 3s + 4
Initial ConditionsInitial state values (optional)0
Sample TimeSet to 0 for continuous systems0

Key Takeaways

Use the Transfer Function block by specifying numerator and denominator coefficient vectors.
Always enter coefficients starting with the highest power term first.
Connect the block properly with input and output signals in your Simulink model.
Avoid improper transfer functions where numerator degree exceeds denominator degree.
Use the Scope block to visualize the system response after simulation.