Error while using transfer function 'tf'

253 views (last 30 days)
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
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
/MATLAB/toolbox/control/ctrlmodels/@tf/tf.m % tf constructor /MATLAB/toolbox/control/ctrlmodels/@DynamicSystem/tf.m % DynamicSystem method /MATLAB/toolbox/ident/ident/@idParametric/tf.m % idParametric method /MATLAB/toolbox/mpc/mpc/@mpc/tf.m % mpc method /MATLAB/toolbox/shared/controllib/engine/@StaticModel/tf.m % StaticModel method
  13 Comments
Dyuman Joshi
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
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)

Sign in to comment.

More Answers (0)

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!