Borrar filtros
Borrar filtros

How can I write the following matrix?

2 visualizaciones (últimos 30 días)
Michelle Ashwini
Michelle Ashwini el 13 de Mzo. de 2014
Comentada: Michelle Ashwini el 14 de Mzo. de 2014
if true
A = [x(1)^2 x(1)*y(1) y(1)^2 x(1) 1;
x(2)^2 x(2)*y(2) y(2)^2 x(2) 1;
x(3)^2 x(3)*y(3) y(3)^2 x(3) 1;
x(4)^2 x(4)*y(4) y(4)^2 x(4) 1;
x(5)^2 x(5)*y(5) y(5)^2 x(5) 1;
x(6)^2 x(6)*y(6) y(6)^2 x(6) 1;
x(7)^2 x(7)*y(7) y(7)^2 x(7) 1;
x(8)^2 x(8)*y(8) y(8)^2 x(8) 1;
x(9)^2 x(9)*y(9) y(9)^2 x(9) 1;
x(10)^2 x(10)*y(10) y(10)^2 x(10) 1 ]
end
The integers 1-10 are meant to be subscripts. I've tried using the syms and repmat functions but have not gotten anywhere further.

Respuesta aceptada

Marta Salas
Marta Salas el 13 de Mzo. de 2014
x = sym('x', [10 1]);
y = sym('y', [10 1]);
if true
A = [x(1)^2 x(1)*y(1) y(1)^2 x(1) 1;
x(2)^2 x(2)*y(2) y(2)^2 x(2) 1;
x(3)^2 x(3)*y(3) y(3)^2 x(3) 1;
x(4)^2 x(4)*y(4) y(4)^2 x(4) 1;
x(5)^2 x(5)*y(5) y(5)^2 x(5) 1;
x(6)^2 x(6)*y(6) y(6)^2 x(6) 1;
x(7)^2 x(7)*y(7) y(7)^2 x(7) 1;
x(8)^2 x(8)*y(8) y(8)^2 x(8) 1;
x(9)^2 x(9)*y(9) y(9)^2 x(9) 1;
x(10)^2 x(10)*y(10) y(10)^2 x(10) 1 ]
end
  11 comentarios
Marta Salas
Marta Salas el 14 de Mzo. de 2014
Editada: Marta Salas el 14 de Mzo. de 2014
Type "ver" on the command line. MATLAB lists all the installed toolboxes. Look for Symbolic Math Toolbox. If you don't have the toolbox, you can not use the symbolic functions.
Michelle Ashwini
Michelle Ashwini el 14 de Mzo. de 2014
Right. It does not have the symbolic math toolbox installed. Is there another way to to the same thing?

Iniciar sesión para comentar.

Más respuestas (1)

Azzi Abdelmalek
Azzi Abdelmalek el 13 de Mzo. de 2014
Editada: Azzi Abdelmalek el 13 de Mzo. de 2014
out=[x.^2 x.*y y.^2.*x ones(10,1)]
% x and y are column vextors

Categorías

Más información sobre Symbolic Math Toolbox en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by