The Sylvester matrix used for solving diophantine equations associated with pole placement control takes a different form that is always square and always of even dimension. It can be implemented quite simply:
If you have polynomials A and B represented as vectors, do the following:
M = sylvester(A,B)
num_n = length(A)1;
num_m = length(B);
% Ensure B is a row vector
siz = size(B);
if siz(1)>siz(2)
B = B';
end
% pad B with zeros to have same length as A
B = [zeros(1,num_n+1num_m) B];
M = zeros(2*num_n);
% Main "algorithm"
for i = 1:num_n
for j = 1:num_n+1
% populate left side
M(j+i1,i) = A(j);
% populate right side
M(j+i1,i+num_n) = B(j);
end
end
Olaf <noreplay@inder.net> wrote in message <hphiqo$53c$1@fuerst.cs.unimagdeburg.de>...
> Hello,
>
> I'm trying to solve the diophantine equation using the sylvester matrix.
> On matlab's homepage I found a mscript sylvester.m
>
> The core of this is:
>
> function M = sylvester(P,Q)
> ...
> NP = numel(P) ;
> NQ = numel(Q) ;
> ...
> MP = toeplitz([P(:) ; zeros(NQ1,1)],zeros(NQ,1)) ;
> MQ = toeplitz([Q(:) ; zeros(NP1,1)],zeros(NP,1)) ;
> M = [MP MQ].' ;
>
> Well, the sylvester matrix shouldn't be square? which isn't here (from
> doc of this):
>
> P = [1 2 3 4] ; Q = [6 7] ;
> size( sylvester(P,Q) )
>
> ans =
> 6 5
>
> What's wrong here? Do I miss something here?
>
> Thanks,
> Olaf
