Matlab Help Trying to arranging in order

Thread Starter

oshaye3

Joined Jan 28, 2011
2
Dear all,
I am trying to arrange this transfer funcion in descending order in order to synchronize with the rest of my code. but it gives me error. look at the results with error. How can I arrange it so that the first order become last TF in the transfer function PLEASE SEE BELOW. ANY LOGIC THANKS. I put the code above as well
Code:
den2 = real(den1)
H1 = tf(1,den2) % Transfer function
A=den2
p=polyfact(A)
p_size=ones(size(p))
num = num2cell(p_size);
H2= tf(num,p)

Transfer function from input 1 to output:
1
-----------------
s^2 + 0.618 s + 1

Transfer function from input 2 to output:
1
-----
s + 1

Transfer function from input 3 to output:
1
-----------------
s^2 + 1.618 s + 1

??? Undefined function or method 'sort' for input arguments of type 'tf'.

Error in ==> mbutter at 43
H2=sort(H2,'descend')
 

etuzuner

Joined Mar 21, 2009
23
Dear oshaye3,

I think there is a problem with using tf function, try to create a matrix which represents the order. I guess you need to define the orders even if they do not exist. For example, the order of the denominator is 3. The order of the numerator is 0. I don't remember exactly but I think you need to define numerator as [1 0 0] instead of 1 in tf function. Take a look to the help menu.

Rich (BB code):
doc tf
 
The error is because you're using a tf object. It's not a typical data structure or vector.

Just sort den2 vector before using tf() function.

Having scalar 1 in the numerator should be fine.
 
Top