[转载][Matlab]部分分式分解法展开分式
2015-04-25 13:39阅读:
在控制领域很多时候要用到部分分式法,例如进行一个高阶系统的拉普拉斯变换或Z变换时,常用将系统展开,然后对各部分进行相应的变换。
部分分式分解算法原理:
![[转载][Matlab]部分分式分解法展开分式 [转载][Matlab]部分分式分解法展开分式](http://s11.sinaimg.cn/bmiddle/408540afh6e0b9e209bba&690)
根据上述算法,编制Matlab函数:function
frac_decomp(num_input,den_input),基本上是基于符号工具箱实
现的。实际上matlab自带了一个分式分解的函数:residue,只不过其输入形式要求固定,输出只是用向量表示,不够直观。
以下给了几个例子:
% Examples:
%
(1) For the fraction bellow:
%
s+2
%
F(s) = ----------------
%
s(s+1)^2(s+3)
% Input:
%
>> num_input = [1
2];
%
>> den_input = [1
0;1 1;1 1;1 3];
%
>>
frac_decomp(num_input,den_input)
%
% Result is:
% roots and counts:
% [
0,
1]
% [ -3,
1]
% [ -1,
2]
%
% symbolic Expression:
%
%
1. s + 2.
%
--------------------
%
2
%
s (s + 3.) (s + 1.)
% Final Expression:
%
%
0.667
0.0833
0.500
0.750
%
----- + ------ -
--------- - ------
%
s
s + 3.
2
s + 1.
%
(s +
1.)
%
%
(2) For the following fraction:
%
1
%
F(s) =
------------------
%
(s+1)^2(s+2s+2)
%
% Input:
%
>> num_input = [1];
%
>> den_input = [0 1 1;0 1 1;1 2 2];
%
>> frac_decomp(num_input,den_input)
%
% Results is:
% roots and counts:
% [ -1+i,
1]
% [ -1-i,
1]
% [
-1,
2]
%
% symbolic Expression:
%
%
1.
%
-----------------------------------------
%
2
%
(s + 1. - 1. I) (s + 1. + 1. I) (s +
1.)
% Final Expression:
%
%
0. - 0.500 I
0. +
0.500 I
1.00 - 0. I
%
- ------------- - ------------- + -----------
%
s + 1. - 1. I
s + 1. + 1. I
2
%
(s + 1.)
%
%
(3) For the following fraction:
%
-4 s + 8
%
---------------
%
2 s^2 + 6 s +
8
%
% Input:
%
>> b = [-4
8];
%
>> a = [2 6
8];
%
>>
frac_decomp(b,a)
%
% Result:
% roots and count:
% [ -3/2+1/2*i*7^(1/2),
1]
% [ -3/2-1/2*i*7^(1/2),
1]
%
% symbolic Expression:
%
%
-2. s + 4.
%
---------------------------------------
%
(s + 1.50 - 1.32 I) (s + 1.50 +
1.32 I)
% Final Expression:
%
%
1.00 + 2.65 I
1.00
- 2.65 I
%
- ----------------- -
-----------------
%
s + 1.50 - 1.32 I
s + 1.50 + 1.32 I
程序下载:
下载地址
以上程序未考虑非严格真分式的情况,即分子的阶次大于等于分母阶次,在这种情况下,只需对分子进行一些处理即可,有兴趣的话可以自己试一下。