Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Sylvester matrix

Subject: Sylvester matrix

From: Olaf

Date: 7 Apr, 2010 09:21:28

Message: 1 of 3

Hello,

I'm trying to solve the diophantine equation using the sylvester matrix.
On matlab's homepage I found a m-script sylvester.m

The core of this is:

function M = sylvester(P,Q)
...
NP = numel(P) ;
NQ = numel(Q) ;
...
MP = toeplitz([P(:) ; zeros(NQ-1,1)],zeros(NQ,1)) ;
MQ = toeplitz([Q(:) ; zeros(NP-1,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

Subject: Sylvester matrix

From: Roger Stafford

Date: 7 Apr, 2010 19:16:05

Message: 2 of 3

Olaf <noreplay@inder.net> wrote in message <hphiqo$53c$1@fuerst.cs.uni-magdeburg.de>...
> Hello,
>
> I'm trying to solve the diophantine equation using the sylvester matrix.
> On matlab's homepage I found a m-script sylvester.m
>
> The core of this is:
>
> function M = sylvester(P,Q)
> ...
> NP = numel(P) ;
> NQ = numel(Q) ;
> ...
> MP = toeplitz([P(:) ; zeros(NQ-1,1)],zeros(NQ,1)) ;
> MQ = toeplitz([Q(:) ; zeros(NP-1,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
----------
  There are apparently two differing notions of a "sylvester matrix". The version mentioned in wikipedia:

 http://en.wikipedia.org/wiki/Sylvester_matrix

which is associated with two polynomials is indeed square. However elsewhere on the internet I see references to sylvester matrices in conjunction with diophantine equations which are definitely not square, as for example at:

 http://homepages.laas.fr/henrion/Papers/6-43-13-16.pdf

and

 http://www2.imm.dtu.dk/pubdb/views/edoc_download.php/3646/pdf/imm3646.pdf

Roger Stafford

Subject: Sylvester matrix

From: Ben

Date: 29 Nov, 2012 06:35:22

Message: 3 of 3

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+1-num_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+i-1,i) = A(j);
        % populate right side
        M(j+i-1,i+num_n) = B(j);
    end
end

Olaf <noreplay@inder.net> wrote in message <hphiqo$53c$1@fuerst.cs.uni-magdeburg.de>...
> Hello,
>
> I'm trying to solve the diophantine equation using the sylvester matrix.
> On matlab's homepage I found a m-script sylvester.m
>
> The core of this is:
>
> function M = sylvester(P,Q)
> ...
> NP = numel(P) ;
> NQ = numel(Q) ;
> ...
> MP = toeplitz([P(:) ; zeros(NQ-1,1)],zeros(NQ,1)) ;
> MQ = toeplitz([Q(:) ; zeros(NP-1,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

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us