[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
modified residues() for matlab compatibility
From: |
Ben Abbott |
Subject: |
modified residues() for matlab compatibility |
Date: |
Sun, 30 Sep 2007 15:40:01 -0400 |
I've made some rather significant modifications to residue.m and
added a companion function, mpoles.m, in order to produce a matlab
compatible version of the former.
The basic change was to add the reciprocal operation.
[r, p, k] = residues (b, a);
and
[b, a] = residues (r, p, k);
I choose to significantly rewrite the residues function. My motive
was to reduce the opportunity for bugs.
Matlab uses the support function mpoles.m to ensure a consistent
treatment of pole multiplicity in each of these operations. So I
decided it made sense to write an equivalent support function for
Octave.
The tests I've run on this implementation were successful. For
example, I compared the patched versions from Hodel and Stewart to my
new implementation.
b = [1 0 1];
a = [1 0 18 0 81];
[r,p,k] = residue(b,a);
disp(num2str(r,'%14.12f'))
My implementation gives
0.000000000000-0.092592591339i
0.222222224416+0.000000000000i
0.000000000000+0.092592591339i
0.222222224416-0.000000000000i
residue from 2.9.14 with Hodel' s patch gives
-0.000000000000+0.092592591966i
0.222222222536-0.000000004302i
-0.000000000000-0.092592591966i
0.222222222536+0.000000004302i
residue from 2.9.14 with Stewart's patch gives
-0.000000000000-0.092592592593i
0.222222223789+0.000000002390i
-0.000000000000+0.092592592593i
0.222222223789-0.000000002390i
I plan to run more test, and see if I can improve the agreement
(differs in the 9th decimal place). However, I thought it a good time
to solicit feedback, and participation in testing.
If anyone has an application that puts residue.m through its paces,
I'd appreciate you taking a look.
Also if anyone is up to checking the scripts for adherence to the
common coding practices of the Octave contributers, I'd appreciate
any feedback.
rresidue_bpa.m
Description: Binary data
mpoles.m
Description: Binary data
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- modified residues() for matlab compatibility,
Ben Abbott <=