tf or "transfer function" will not work on my fresh install of matlab

So I want to use tf to make a transfer function. I get this insted...
Error using tf (line 249)
Invalid syntax. The first input argument of the "tf" command cannot be a string.
I have tried to track down the problem in numerous ways. It wount even run the tf code example that matlab provides.
the code I have tried so far are:
clear all
clc
s = tf('s');
sys = s/(s^2 + 2*s + 10)
***************************************
***************
function Gs = tf1or2(gainORzeta, tauORwn, order) %%This is a function that takes gain,tou,order and greates a transfer function
if order == 1
disp ('This is a first order transfer function')
Gs=tf(gainORzeta,tauORwn)
end
end
*****************************************************
I have also tried to directly input numbers into the tf function to get it to work. Same error
Waiting for some help...

5 comentarios

Hi Christopher Piland,
The function tf() does only accept either 's' or 'z' as char argument. The other possibilities to create transfer functions with tf-command are listed here: https://de.mathworks.com/help/control/ref/tf.html?searchHighlight=tf&s_tid=doc_srchtitle
You function tf1or2() calls tf() using arbitrary values for gain and time constant, it seems. Please, provide information about that function call especialle the variable types. I guess, you are not providing numerator/denumerator-vectors.
You would have to calculate the numerator/denumerator from the given desired values before plugging them into the tf()-function.
Kind regards,
Robert
Just a question is It normal to have a transfer function like this ?
It's definied by :
Real(TF(v)) = cos(2*pi*v).
and phase is 0.
I thing that the parameter s=j*w.
So is It normal to have a real part like this? ( parameter in the cosine)
and how to get transfert function from real and image parts.
Walter Roberson
Walter Roberson el 10 de Jun. de 2021
Editada: Walter Roberson el 12 de Jun. de 2021
No, that is not typical. If you had that as the laplace transform of some function then you should be able to do an inverse laplace in order to get the original time-domain function. However, there is no inverse laplace defined for that using standard mathematical functions.
If you try an approach such as taking a taylor approximation of the cos() and then take the inverse laplace of that, then you get an expression which is the sum of coefficients times various derivatives of dirac delta. The limit for that is 0 for all non-zero times because of the dirac delta... but the limit is also 0 for time 0. Except possibly for some oddity due to dealing with infinity, you can see that cos(2*pi*v) cannot be the laplace transform of any useful function (or else that there is some mathematical reason why you cannot use taylor series in these kinds of analysis)
(My internal tracking number for this is T0098910)
the V is a space frequency ! I noticed that, so is there a solution for this?

Iniciar sesión para comentar.

Respuestas (1)

One of the common errs happen with many users is that accidentally without intention you may have called a variable or m-file or fcn file with 'tf'.
Have you tried this syntax to generate the transfer function formulation:
T = tf([1, 1], [1 2 3]);

3 comentarios

I have done that exactly, however my Matlab doesn't recognize the 'tf' function. I read some content about this error and appearently something with my toolbox is not right. I am new to Matlab, so do you have any idea on how to solve that error.
tf() is part of the Control System Toolbox product, which is an optional product that must be licensed and installed.
If you happen to have purchased the Student Suite bundle then that toolbox is included in the bundle, but you might not happen to have installed it yet.
@walter robertson Thank you, that clarifies everything.

Iniciar sesión para comentar.

Categorías

Preguntada:

el 17 de Oct. de 2019

Comentada:

el 7 de Dic. de 2022

Community Treasure Hunt

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

Start Hunting!

Translated by