Convert transfer function writing form
10 次查看(过去 30 天)
显示 更早的评论
How to convert transfer function writing form Matlab form to canonical from via Matlab?
canonical form:
Example:
0 个评论
采纳的回答
Paul
2021-3-14
编辑:Paul
2021-3-14
Maybe something like this:
>> H = tf([15 25 1],[5 0 5],-1)
H =
15 z^2 + 25 z + 1
-----------------
5 z^2 + 5
Sample time: unspecified
Discrete-time transfer function.
>> H.Variable='z^-1'
H =
15 + 25 z^-1 + z^-2
-------------------
5 + 5 z^-2
Sample time: unspecified
Discrete-time transfer function.
>> minreal(H)
ans =
3 + 5 z^-1 + 0.2 z^-2
---------------------
1 + z^-2
Sample time: unspecified
Discrete-time transfer function.
Note that minrea() will remove common poles/zeros in addition to normalizing so that the denominator has a leading coefficient of 1. Alternatively, convert to one of the other forms and then coonvert back to normalize the denominator, e.g.,
>> H
H =
3 z^2 + 5 z + 0.2
-----------------
z^2 + 1
Sample time: unspecified
Discrete-time transfer function.
>> tf(zpk(H))
ans =
3 z^2 + 5 z + 0.2
-----------------
z^2 + 1
Sample time: unspecified
Discrete-time transfer function.
Can also write the transfer function in terms of z^-1 from the start:
>> H = tf([15 25 1],[5 0 5],-1,'Variable','z^-1')
H =
15 + 25 z^-1 + z^-2
-------------------
5 + 5 z^-2
Sample time: unspecified
Discrete-time transfer function.
0 个评论
更多回答(1 个)
Walter Roberson
2021-3-14
temp = cellfun(@(n, d) tf(n./d(1),d./d(1),h.Ts),h.num,h.den,'uniform', 0)
This returns a cell array with size output dimensions by input dimensions. This turns out to be the easy part. The harder part is automatically putting the cell back together the right way. You cannot create a vector and reshape. You can vertcat and horzcat but unless you loop somehow over rows or columns you have trouble getting the right size output.
It might even be easier to create the cells separately and build one tf... might work.
3 个评论
Walter Roberson
2021-3-14
Ah, I did not notice the change in coordinates (it was pretty late my time!)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
