How to generate this lower triangular matrix?

4 visualizaciones (últimos 30 días)
moonthedrow
moonthedrow el 23 de Mzo. de 2015
Comentada: Stephen23 el 23 de Mzo. de 2015
Given an array of x, how to generate this matrix?

Respuestas (1)

John D'Errico
John D'Errico el 23 de Mzo. de 2015
Editada: John D'Errico el 23 de Mzo. de 2015
This should work. Assume that x is a column vector.
x = [2 3 5 7 11 13]';
A = bsxfun(@minus,x,x');
A = [ones(size(x)),A(:,1:n-1)];
cumprod(A,2)
ans =
1 0 0 0 0 0
1 1 0 0 0 0
1 3 6 0 0 0
1 5 20 40 0 0
1 9 72 432 1728 0
1 11 110 880 5280 10560

Categorías

Más información sobre Polynomials en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by