File Exchange

version 1.0 (1.75 KB) by

Computes the reduced order model for a given system by matching time moments

Updated

Given a transfer function G, the script computes an approximate reduced order model of the system using the technique of moment matching.
If

If the power series expansion of G is
G=c0+c1*s+c2*s^2+...+c_(2r)s^(2r)+c_(2r+1)s^(2r+1)+...
and then that of R would be
R=c0+c1*s+c2*s^2+...+c_(2r)s^(2r)+.....
with the first 2r coefficients of both series being matched.

Lee Ziyang

Seis Erres

### Seis Erres (view profile)

Nice function especially useful for reducing systems coming from matlab linearizations.

There is a little mistake in the code easily catch by M-lint

wrong

if ~isreal(r) || (fix(r)~=r) || (r<1) || (r>n) %%% here n is undefined
error('Invalid value of reduced model order')
end
[num,den]=tfdata(G,'v');
D_fact=num(1)/den(1);
num=num-D_fact*den;
num1=num(end:-1:1)/den(1);
den1=den(end:-1:1)/den(1);
n=length(den1)-1;

right

[num,den]=tfdata(G,'v');
D_fact=num(1)/den(1);
num=num-D_fact*den;
num1=num(end:-1:1)/den(1);
den1=den(end:-1:1)/den(1);
n=length(den1)-1;

if ~isreal(r) || (fix(r)~=r) || (r<1) || (r>n)
error('Invalid value of reduced model order')
end

I would like to know if the author agree with this correction.

Apart from this correction the function works nicely. I find it very useful and I thank the author for sharing it.

Regards.

MATLAB 7 (R14)