Receiving error "Unrecognized function or variable 'tf'" even though I have the Signal Processing Toolbox installed.

38 次查看(过去 30 天)
I am trying to produce a bode plot using the tf function. My code is as follows:
num = [10000000000000000000000000000 7000000000000000000000000000000];
den = [1 7540690 21324854073600 26807731666619904000 12647107451415440994336768 10730685839764156310146252800];
G = tf(num, den)
bode(G),grid;
The error is in line 4. I am receiving the error message despite having the Signal Processing Toolbox installed. When I type "ver" into the command window I get this:
MATLAB Version: 9.10.0.1669831 (R2021a) Update 2
Operating System: Microsoft Windows 10 Home Version 10.0 (Build 19042)
Java Version: Java 1.8.0_202-b08 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
-----------------------------------------------------------------------------------------------------
MATLAB Version 9.10 (R2021a)
Signal Processing Toolbox Version 8.6 (R2021a)
I am new to MATLAB so I would appreciate any pointers. Thank you.
  2 个评论
Matthew Crain
Matthew Crain 2021-6-6
Nevermind! I found that I needed the Control Systems Toolbox add-on. Apparently the tf function is not a part of the Signals Processing Toolbox. The more you know!
Brian Mcnulty
Brian Mcnulty 2022-4-18
the 'tf' command is not recognized and the command window provides a reccomendation instead.
I have all the correct toolboxes installed, however, the error persists.
What can I do to alleviate this issue. Any suggestions would be greatly appreciated. Thank you in advance.

请先登录,再进行评论。

回答(1 个)

Steven Lord
Steven Lord 2021-6-6
which -all tf
/MATLAB/toolbox/control/ctrlmodels/@tf/tf.m % tf constructor /MATLAB/toolbox/mpc/mpc/@mpc/tf.m % Shadowed mpc method /MATLAB/toolbox/control/ctrlmodels/@DynamicSystem/tf.m % Shadowed DynamicSystem method /MATLAB/toolbox/ident/ident/@idParametric/tf.m % Shadowed idParametric method /MATLAB/toolbox/shared/controllib/engine/@StaticModel/tf.m % Shadowed StaticModel method
There are several functions named tf in various MathWorks products, but most of them are intended for use in converting some sort of other object into a tf object. As you have learned the tf function in Control System Toolbox (the first on that list) is what you should use for creating a tf object from raw numeric data.

类别

Help CenterFile Exchange 中查找有关 Get Started with Control System Toolbox 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by