How to add power of x from 0 to n-1
9 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Karim Belkhiria
el 5 de Nov. de 2015
Comentada: Matt J
el 5 de Nov. de 2015
I have a function vandermonde
function c = vandermonde(x, y)
V = [x.^0 x x.^2 x.^3]
c = V \ y;
end
it works good if I give a vector x with 4 components. But how could I make it general, even if I give a vector x with 5,6 or even 15 components? so that V = [x.^0 x x.^2 x.^3 x.^4 x.^5 .... x.^14] ? with n or something like that?
0 comentarios
Respuesta aceptada
Más respuestas (1)
Karim Belkhiria
el 5 de Nov. de 2015
Editada: Karim Belkhiria
el 5 de Nov. de 2015
1 comentario
Matt J
el 5 de Nov. de 2015
I wonder if your teacher would also have accepted this
V=exp(log(x(:))*(0:n-1))
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!