Filling results from for loop into an array/matrix?
Mostrar comentarios más antiguos
I have this function that computes the coefficients of a polynomial of a certain degree:
n = input('Degree of polynomial: ');
for k = 1:n
syms x y
z(k) = (x+y)^k;
coeff = coeffs(z(k));
c = double(coeff);
end
And I'm trying to store all the coefficients into one matrix. i.e.
c =
1 1
1 2 1
1 3 3 1
...
Instead my value for "c" is just the last iteration of the loop (c = 1 3 3 1). I tried to change c(k) but it doesn't work. What should I do here?
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Polynomials en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!