Written and maintained by CASRAI Editorial Board
Published
On this page
Short answer: in MATLAB, tf creates a transfer function model object. You pass coefficient vectors, sys = tf(numerator,denominator), or you define s = tf('s') and write the model as a rational expression. This guide is for researchers and analysts who need to build a transfer function, read what MATLAB prints, and get the coefficients back out. The commands and displayed output below follow the MathWorks documentation for tf and tfdata, read 2026-11-08.
What tf is used for in research
A transfer function relates the input of a linear system to its output as a ratio of polynomials in s (continuous time) or z (discrete time). In MATLAB, tf is the function that stores such a model as a single object, so that later analysis functions can take it as an argument. The MathWorks reference page for tf is titled “tf – Transfer function model” and lists it under the Control System Toolbox documentation.
The same function answers several phrasings of the question. tf function MATLAB, matlab tf and tf in matlab all refer to tf as described here. For signal processing in MATLAB more broadly, see the CASRAI guide on signal analysis in MATLAB.
Install or access (official source only)
The MathWorks documentation places tf in the Control System Toolbox. It states no separate requirement for basic use of tf; it names other products only for specific features: System Identification Toolbox for identified models, Robust Control Toolbox for uncertain (uss) models, and Parallel Computing Toolbox for the UseParallel option. Get MATLAB and its toolboxes only from MathWorks (mathworks.com/help/control/ref/tf.html). For general MATLAB habits before you start, see MATLAB coding.
Step-by-step: create a transfer function with tf
There are three construction routes. Each produces the same kind of object; choose the one that matches how your equation is written.
Route 1: coefficient vectors (continuous time)
- Write the numerator and denominator as row vectors of coefficients in descending powers of
s. The polynomial 7s2 + 8s – 9 is entered as[7 8 -9]. - Call
tf:numerator = 1; denominator = [2,3,4]; sys = tf(numerator,denominator) - MATLAB displays
1/(2 s^2 + 3 s + 4)followed by “Continuous-time transfer function.”
Route 2: discrete time with a sample time
- Add a third argument, the sample time
tsin seconds:numerator = [2,0]; denominator = [4,0,3,-1]; ts = 0.1; sys = tf(numerator,denominator,ts) - MATLAB displays
2 z/(4 z^3 + 3 z - 1), then “Sample time: 0.1 seconds” and “Discrete-time transfer function.” - Setting
tsto-1leaves the sample time unspecified.
Route 3: rational expressions with s or z
- Continuous time: define the variable, then write the model as arithmetic:
s = tf('s'); sys = s/(s^2 + 2*s + 10) - Discrete time: define
zwith the sample time:ts = 0.1; z = tf('z',ts); sys = (z - 1)/(z^2 - 1.85*z + 0.9)
The three routes side by side
| Route | Call | Time domain | Printed label |
|---|---|---|---|
| Coefficient vectors | tf(numerator,denominator) |
Continuous | Continuous-time transfer function. |
| Coefficient vectors plus sample time | tf(numerator,denominator,ts) |
Discrete | Sample time: 0.1 seconds, Discrete-time transfer function. |
Variable s |
s = tf('s'), then an expression in s |
Continuous | Continuous-time transfer function. |
Variable z |
z = tf('z',ts), then an expression in z |
Discrete | Discrete-time transfer function. |
The reference page also documents tf(m) for a static gain m and tf(ltiSys) for converting another dynamic system model to a transfer function. For multiple-input, multiple-output (MIMO) models, the numerator and denominator are given as cell arrays.
Output and how to read it
The printed form is a ratio with the highest power first. In the Route 2 example, the numerator vector [2,0] prints as 2 z because the trailing zero is the constant term, and the denominator [4,0,3,-1] prints as 4 z^3 + 3 z - 1 because the zero is the missing z^2 term.
Getting the coefficients back with tfdata
tfdata returns the numerator and denominator of an existing model:
[num,den] = tfdata(sys);
[num,den,ts] = tfdata(sys);
[num,den] = tfdata(sys,'v');
For a single model, num and den are 2-D cell arrays (outputs by inputs), and each cell holds a row vector ordered from the highest to the lowest power of s or z. This is the usual surprise: you must index a cell (num{1}) or display with celldisp, not treat num as a vector. For a single-input, single-output model, the 'v' option returns plain row vectors instead. In the MathWorks discrete example, tfdata returns num{1} = 0 0 2 0, den{1} = 4 0 3 -1 and ts = 0.1000; note that the numerator is padded with leading zeros to the denominator’s length.
Troubleshooting
Wrong powers: the coefficient order
Coefficients run from the highest power to the constant. A missing term needs an explicit zero, as in [4,0,3,-1]. Omitting the zero silently shifts every later coefficient to a different power and the shorter vector is still a valid input.
Unrecognized function or variable ‘tf’
The documentation lists tf under the Control System Toolbox. If MATLAB reports that tf is unrecognized, a likely cause is that this toolbox is not installed or licensed for your session; this is an inference from the documentation, not a statement MathWorks makes about that error message. Check which products your installation has, and consult MathWorks support for your license.
Discrete model prints the wrong time domain
If the output says “Continuous-time transfer function,” you did not pass ts (or use tf('z',ts)). Add the sample time argument.
Using the result as numbers
If a script expects a numeric vector and gets a cell array, switch to tfdata(sys,'v') for a SISO model, as described above.
Free alternatives
| Tool | Equivalent call | What the documentation states |
|---|---|---|
python-control (control.matlab.tf) |
tf(num, den[, dt]), tf('s'), tf('z') |
Coefficients are ordered so that [2,3,4] means 2s2 + 3s + 4. dt of 0 is continuous, a positive number is the sampling time, and True is discrete with unspecified time. Can create MIMO systems. tf(sys_ss) converts a state-space system. |
The python-control example from its documentation defines s = ct.tf('s') and then G = (s+1)/(s**2+2*s+1), the same rational-expression style as Route 3 above. Its documentation page was read 2026-11-08 at python-control.readthedocs.io. For Python numerical work in a related setting, see NumPy polyfit.
FAQ
What does tf do in MATLAB?
It creates a transfer function model object from numerator and denominator coefficients, from a rational expression in s or z, or by converting another model type.
How do I enter the coefficients?
As row vectors in descending powers. For example 7s2 + 8s – 9 is [7 8 -9].
How do I make a discrete-time transfer function?
Pass the sample time as the third argument, tf(numerator,denominator,ts), or define z = tf('z',ts) and write the expression in z.
How do I get the numerator and denominator back out?
Use [num,den] = tfdata(sys). The outputs are cell arrays; use 'v' for a single-input, single-output model to get row vectors.
Why is MATLAB not recognizing tf?
See the troubleshooting section: tf is documented as part of the Control System Toolbox, so a missing toolbox is one possible cause.
Where do I go for plotting a transfer function?
Plotting is outside the scope of this guide; for general plotting in MATLAB, see MATLAB figures.
Sources (official documentation)
- MathWorks, “tf – Transfer function model”: mathworks.com/help/control/ref/tf.html (read 2026-11-08).
- MathWorks, “tfdata – Access transfer function data”: mathworks.com/help/control/ref/dynamicsystem.tfdata.html (read 2026-11-08).
- python-control documentation, “control.matlab.tf”: python-control.readthedocs.io (read 2026-11-08).







