matlab code help (tf)

Thread Starter

suzuki

Joined Aug 10, 2011
119
Hi, I want to write a transfer function in matlab. I know we usually write in the following way

trans = tf([1 0 0], [1 0 1]);
This gives something as a function of 's'.

what if i wanted to write an equation that was a function of 's+x', where x is a constant. So instead of H(s), i want to write a function and evaluate at values of say H(s+5).

thanks
 

steveb

Joined Jul 3, 2008
2,436
Hi, I want to write a transfer function in matlab. I know we usually write in the following way

trans = tf([1 0 0], [1 0 1]);
This gives something as a function of 's'.

what if i wanted to write an equation that was a function of 's+x', where x is a constant. So instead of H(s), i want to write a function and evaluate at values of say H(s+5).

thanks
The numbers you use for the vectors in the "tf" command can be variables too. For example, the following would be allowed.

A=1;
B=0;
C=0;
D=1;
E=0;
F=1;
trans = tf([A B C], [D E F]);
 

Thread Starter

suzuki

Joined Aug 10, 2011
119
hmm, sorry, but i might have not been clear with my question. I see in the case you listed above that you can define the coefficients as variables. In my case, what i desire is that instead of computing

s^2/ s^2+1

i want to compute

(s+j5)^2/((s+j5)^2+1)

is this possible?

edit: on second thought, i could probably expand the polynomial in this case, but if this was a nth order polynomial, that may not be convenient, so i'd still like to know how to code this function, thanks

edit edit: now that i have actually expanded the polynomial, i find that i know longer have a function of 's', rather, i am left with a bunch of real numbers. can i still use the bode() and tf() calls here?
 
Last edited:

MrChips

Joined Oct 2, 2009
30,824
Not quite sure what is your question.

Have you actually tried this in Matlab?

You can type

s = 2


s + 5i

or

s + 5j


(s+5j)^2/((s+5j)^2+1)
 

Georacer

Joined Nov 25, 2009
5,182
I probably don't see the real issue here, but if you want to evaluate H(s+5) you could transform your variable:

Rich (BB code):
input=10;
trans_input=input+5;
H(trans_input);
If, however, you want to use the tf function to evaluate the shifted-polynomial transfer function, you might need to play a bit with the polynomial functions library. I 'll get back to you when I get home.
 
Top