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:
Forming a Sylvester Matrix, do you use toeplitz?

Subject: Forming a Sylvester Matrix, do you use toeplitz?

From: theconster@gmail.com

Date: 15 May, 2009 02:46:19

Message: 1 of 4

Hello, I am a newbie when it comes to MATLAB and am womdering how to Form a sylvester matrix given two polynomials.

Here are the requirements in full:

function S = sylvester(a,b)
%SYLVESTER Sylvester matrix for two polynomials.
% S = SYLVESTER(A,B), where A is an (N+1)-vector and B is an (M+1)-vector,
% is the (M+N)-by-(M+N) Sylvester matrix for the polynomials
% p(x) = a(1)*x^n + ... + a(n)*x + a(n+1) and
% q(x) = b(1)*x^m + ... + b(m)*x + b(m+1).

I assume it has something to do with the toeplitz command but I am unsure of how exactly to do it.

Any help would be much appreciated!

Subject: Forming a Sylvester Matrix, do you use toeplitz?

From: theconster@gmail.com

Date: 15 May, 2009 03:18:18

Message: 2 of 4

I am not allowed to use loops by the way;

Also in my own efforts to solve this problem I have realised I don't know how to actually write p(x) with this form into MATLAB.

Subject: Forming a Sylvester Matrix, do you use toeplitz?

From: Matt Fig

Date: 15 May, 2009 03:32:01

Message: 3 of 4

One approach:


p1 = [2 3 4 5 5]; % Polynomials
p2 = [6 7 8 9];
L1 = length(p1) - 2; % The necessary lengths.
L2 = length(p2) - 2;
C1 = arrayfun(@(x) circshift([p1 zeros(1,L2)]',[x 1]),[0:L2],'Un',0);
C1 = [C1{:}];
C2 = arrayfun(@(x) circshift([p2 zeros(1,L1)]',[x 1]),[0:L1],'Un',0);
C2 = [C2{:}];

Syl = [C1';C2']

Subject: Forming a Sylvester Matrix, do you use toeplitz?

From: Jos

Date: 15 May, 2009 10:44:02

Message: 4 of 4

"theconster@gmail.com" <theconster@gmail.com> wrote in message <32088261.105572.1242357529141.JavaMail.jakarta@nitrogen.mathforum.org>...
> I am not allowed to use loops by the way;
>
> Also in my own efforts to solve this problem I have realised I don't know how to actually write p(x) with this form into MATLAB.


p1 = [1 2 3 4 5] ; p2 = [6 7 8] ;
% Hint:
toeplitz([p1 0 0],[0 0 0]).'

Find out the relation between p2 and the number of zeros ...

hth
Jos

Tags for this Thread

No tags are associated with 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