0
0
SimulinkHow-ToBeginner · 4 min read

How to Model Transfer Function in Simulink: Step-by-Step Guide

In Simulink, model a transfer function by dragging the Transfer Function block from the Simulink library and entering the numerator and denominator coefficients as vectors. This block represents the system's transfer function mathematically and can be connected to other blocks for simulation.
📐

Syntax

The Transfer Function block requires two main inputs: Numerator and Denominator coefficients. These are vectors representing the polynomial coefficients of the transfer function.

  • Numerator: Coefficients of the numerator polynomial in descending powers of s.
  • Denominator: Coefficients of the denominator polynomial in descending powers of s.

Example: For a transfer function H(s) = (s + 3) / (s^2 + 2s + 1), numerator is [1 3], denominator is [1 2 1].

matlab
Numerator = [1 3];
Denominator = [1 2 1];
% Enter these vectors in the Transfer Function block parameters in Simulink
💻

Example

This example shows how to model the transfer function H(s) = (s + 3) / (s^2 + 2s + 1) in Simulink and simulate its step response.

matlab
% Open Simulink and create a new model
model = 'transfer_function_example';
new_system(model);
open_system(model);

% Add Transfer Function block
add_block('simulink/Continuous/Transfer Fcn',[model '/Transfer Function']);

% Set numerator and denominator
set_param([model '/Transfer Function'], 'Numerator', '[1 3]', 'Denominator', '[1 2 1]');

% Add Step input block
add_block('simulink/Sources/Step',[model '/Step Input']);

% Add Scope block
add_block('simulink/Sinks/Scope',[model '/Scope']);

% Connect blocks
add_line(model,'Step Input/1','Transfer Function/1');
add_line(model,'Transfer Function/1','Scope/1');

% Run simulation
sim(model);

% The Scope will show the step response of the transfer function
Output
Simulink model opens with Transfer Function block connected to Step Input and Scope; running simulation displays step response on Scope.
⚠️

Common Pitfalls

  • Incorrect coefficient order: Coefficients must be in descending powers of s, not ascending.
  • Empty numerator or denominator: Both must be non-empty vectors; denominator cannot be zero.
  • Forgetting to connect blocks: The Transfer Function block alone does nothing without input and output connections.
  • Using scalar values instead of vectors: Even for simple transfer functions, use vector notation like [1 0] for s.
matlab
% Wrong way: numerator in ascending order
% set_param([model '/Transfer Function'], 'Numerator', '[3 1]'); % Incorrect

% Right way:
% set_param([model '/Transfer Function'], 'Numerator', '[1 3]'); % Correct
📊

Quick Reference

ParameterDescriptionExample
NumeratorCoefficients of numerator polynomial in descending powers of s[1 3] for s + 3
DenominatorCoefficients of denominator polynomial in descending powers of s[1 2 1] for s^2 + 2s + 1
InputSignal source block like Step or Sine WaveStep block
OutputSink block to observe output like ScopeScope block

Key Takeaways

Use the Transfer Function block and enter numerator and denominator as coefficient vectors in descending powers of s.
Always connect input and output blocks to simulate and observe the transfer function behavior.
Check coefficient order carefully to avoid incorrect system modeling.
Simulate with a Step input and Scope output to visualize the system response quickly.