You are now following this question
- You will see updates in your followed content feed.
- You may receive emails, depending on your communication preferences.
Error while using transfer function 'tf'
252 views (last 30 days)
Show older comments
I tried different inputs as numerator and denominator to create a transfer function using 'tf' command, but my MATLAB leaves this message everytime: 'Incorrect number or types of inputs or outputs for function 'tf''. And this exact code runs perfectly in online MATLAB FYI. Any help is appreciated!
theta_hat = [-1.77627176214971;0.790085804375558;-0.0407175636083817;0.0479175052321617];
a1 = theta_hat(1); a2 = theta_hat(2); b0 = theta_hat(3); b1=theta_hat(4);
num=[b0 b1];den=[1 a1 a2];gz = tf(num,den);
Accepted Answer
Sam Chak
on 18 Nov 2023
Please check if you have a user-defined function m-file with the same name as 'tf' that is saved in the current path.
which -all tf
13 Comments
Keerthik Dhivya
on 18 Nov 2023
Please find the attached result i have got in command window here:
Sam Chak
on 18 Nov 2023
Thanks @Keerthik Dhivya, I see it now. It appears that the Control System Toolbox is not installed. The 'tf' function from the Control System Toolbox is necessary to represent linear dynamical systems in transfer function form. This likely explains why it returns the error message 'Incorrect number or types of inputs or outputs for function tf'.
Keerthik Dhivya
on 18 Nov 2023
I installed control system toolbox, now its working well.
Thanks for your timely help! @Sam Chak
Sam Chak
on 18 Nov 2023
You're welcome, @Keerthik Dhivya. Feel free to post a new question if you encounter the control design problem. The plant gz(s) is unstable.
theta_hat = [-1.77627176214971;0.790085804375558;-0.0407175636083817;0.0479175052321617];
a1 = theta_hat(1); a2 = theta_hat(2); b0 = theta_hat(3); b1=theta_hat(4);
num=[b0 b1]; den=[1 a1 a2]; gz = tf(num,den)
gz =
-0.04072 s + 0.04792
----------------------
s^2 - 1.776 s + 0.7901
Continuous-time transfer function.
step(gz)
Keerthik Dhivya
on 18 Nov 2023
Sure, thanks again!
joseph timoney
on 7 Dec 2023
Hi, did you find an answer to this. I have the exact same problem. It just won't work in the desktop version and I don't have any other m-files withe the same name, Thanks, Joe
Walter Roberson
on 7 Dec 2023
What code are you executing, and what error message are you getting?
Do you have the Control System Toolbox installed and licensed?
Sam Chak
on 7 Dec 2023
@joseph timoney, please type this and report what you see on the status output and the errmsg output:
[status, errmsg] = license('checkout', 'Control_Toolbox')
joseph timoney
on 7 Dec 2023
Hi Sam it says
[status, errmsg] = license('checkout', 'Control_Toolbox')
status =
1
errmsg =
0×0 empty char array
I have a sitewide license with my institution. Let me know what you think, thanks,
joseph timoney
on 7 Dec 2023
numerator = 1;
denominator = [2,3,4];
sys = tf(numerator,denominator)
"Incorrect number or types of inputs or outputs for function 'tf'."
Is there a conflict beteen tf in the signal processing toolbox and tf in the control toolbox?
Dyuman Joshi
on 7 Dec 2023
Edited: Dyuman Joshi
on 7 Dec 2023
That code checks whether a particular item is licensed or not.
Type "ver" in the command window and see if the Control System Toolbox is installed or not.
Sam Chak
on 7 Dec 2023
@joseph timoney, If the Control System Toolbox is installed in your machine, you should see the tf.m file under the control folder. Also use ver as advised by @Dyuman Joshi.
ver
-----------------------------------------------------------------------------------------------------
MATLAB Version: 23.2.0.2436196 (R2023b) Update 4
MATLAB License Number: 0
Operating System: Linux 5.4.233-0504233-generic #202302250651 SMP Sat Feb 25 12:26:27 UTC 2023 x86_64
Java Version: Java 1.8.0_292-b10 with AdoptOpenJDK OpenJDK 64-Bit Server VM mixed mode
-----------------------------------------------------------------------------------------------------
MATLAB Version 23.2 (R2023b)
Simulink Version 23.2 (R2023b)
5G Toolbox Version 23.2 (R2023b)
Aerospace Blockset Version 23.2 (R2023b)
Aerospace Toolbox Version 23.2 (R2023b)
Antenna Toolbox Version 23.2 (R2023b)
Audio Toolbox Version 23.2 (R2023b)
Automated Driving Toolbox Version 23.2 (R2023b)
Bioinformatics Toolbox Version 23.2 (R2023b)
Bluetooth Toolbox Version 23.2 (R2023b)
Communications Toolbox Version 23.2 (R2023b)
Computer Vision Toolbox Version 23.2 (R2023b)
Control System Toolbox Version 23.2 (R2023b)
Curve Fitting Toolbox Version 23.2 (R2023b)
DO Qualification Kit Version 23.2 (R2023b)
DSP System Toolbox Version 23.2 (R2023b)
Database Toolbox Version 23.2 (R2023b)
Datafeed Toolbox Version 23.2 (R2023b)
Deep Learning Toolbox Version 23.2 (R2023b)
Econometrics Toolbox Version 23.2 (R2023b)
Embedded Coder Version 23.2 (R2023b)
Filter Design HDL Coder Version 23.2 (R2023b)
Financial Instruments Toolbox Version 23.2 (R2023b)
Financial Toolbox Version 23.2 (R2023b)
Fixed-Point Designer Version 23.2 (R2023b)
Fuzzy Logic Toolbox Version 23.2 (R2023b)
Global Optimization Toolbox Version 23.2 (R2023b)
HDL Coder Version 23.2 (R2023b)
HDL Verifier Version 23.2 (R2023b)
IEC Certification Kit Version 23.2 (R2023b)
Image Acquisition Toolbox Version 23.2 (R2023b)
Image Processing Toolbox Version 23.2 (R2023b)
Industrial Communication Toolbox Version 23.2 (R2023b)
Instrument Control Toolbox Version 23.2 (R2023b)
LTE Toolbox Version 23.2 (R2023b)
MATLAB Compiler Version 23.2 (R2023b)
MATLAB Compiler SDK Version 23.2 (R2023b)
MATLAB Report Generator Version 23.2 (R2023b)
Mapping Toolbox Version 23.2 (R2023b)
Mixed-Signal Blockset Version 23.2 (R2023b)
Model Predictive Control Toolbox Version 23.2 (R2023b)
Navigation Toolbox Version 23.2 (R2023b)
Optimization Toolbox Version 23.2 (R2023b)
Parallel Computing Toolbox Version 23.2 (R2023b)
Partial Differential Equation Toolbox Version 23.2 (R2023b)
Phased Array System Toolbox Version 23.2 (R2023b)
Powertrain Blockset Version 23.2 (R2023b)
Predictive Maintenance Toolbox Version 23.2 (R2023b)
RF Blockset Version 23.2 (R2023b)
RF Toolbox Version 23.2 (R2023b)
Requirements Toolbox Version 23.2 (R2023b)
Risk Management Toolbox Version 23.2 (R2023b)
Robotics System Toolbox Version 23.2 (R2023b)
Robust Control Toolbox Version 23.2 (R2023b)
Sensor Fusion and Tracking Toolbox Version 23.2 (R2023b)
SerDes Toolbox Version 23.2 (R2023b)
Signal Processing Toolbox Version 23.2 (R2023b)
SimBiology Version 23.2 (R2023b)
SimEvents Version 23.2 (R2023b)
Simscape Version 23.2 (R2023b)
Simscape Driveline Version 23.2 (R2023b)
Simscape Electrical Version 23.2 (R2023b)
Simscape Fluids Version 23.2 (R2023b)
Simscape Multibody Version 23.2 (R2023b)
Simulink 3D Animation Version 23.2 (R2023b)
Simulink Check Version 23.2 (R2023b)
Simulink Code Inspector Version 23.2 (R2023b)
Simulink Coder Version 23.2 (R2023b)
Simulink Control Design Version 23.2 (R2023b)
Simulink Coverage Version 23.2 (R2023b)
Simulink Design Optimization Version 23.2 (R2023b)
Simulink Design Verifier Version 23.2 (R2023b)
Simulink Desktop Real-Time Version 23.2 (R2023b)
Simulink PLC Coder Version 23.2 (R2023b)
Simulink Real-Time Version 23.2 (R2023b)
Simulink Report Generator Version 23.2 (R2023b)
Simulink Test Version 23.2 (R2023b)
Stateflow Version 23.2 (R2023b)
Statistics and Machine Learning Toolbox Version 23.2 (R2023b)
Symbolic Math Toolbox Version 23.2 (R2023b)
System Identification Toolbox Version 23.2 (R2023b)
Text Analytics Toolbox Version 23.2 (R2023b)
Vehicle Dynamics Blockset Version 23.2 (R2023b)
Vehicle Network Toolbox Version 23.2 (R2023b)
Vision HDL Toolbox Version 23.2 (R2023b)
WLAN Toolbox Version 23.2 (R2023b)
Wavelet Toolbox Version 23.2 (R2023b)
Wireless HDL Toolbox Version 23.2 (R2023b)
More Answers (0)
See Also
Categories
Find more on Get Started with DSP System Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!An Error Occurred
Unable to complete the action because of changes made to the page. Reload the page to see its updated state.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)