Code covered by the BSD License

4.0
4.0 | 2 ratings Rate this file 3 Downloads (last 30 days) File Size: 1.75 KB File ID: #21466 Version: 1.0

### Janardhanan Sivaramakrishnan (view profile)

18 Sep 2008 (Updated )

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

File Information
Description

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.

Required Products Control System Toolbox
MATLAB release MATLAB 7 (R14)
02 Feb 2012 Lee Ziyang

### Lee Ziyang (view profile)

24 Jul 2009 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.