Info
La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.
Using array as a for loop
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Harel Harel Shattenstein
el 13 de Mzo. de 2016
Cerrada: MATLAB Answer Bot
el 20 de Ag. de 2021
I need to solve the polynomial x^4+nx^3-1 for n=-1,0,1 (without using for loop)
What I did is:
n=(-1:1:1);
co_poly=[1 n 0 0 -1];
roots(co_poly)
but it just put the array n inside the coefficients array.
0 comentarios
Respuestas (1)
Geoff Hayes
el 13 de Mzo. de 2016
Harel - why don't you just iterate over each n and calculate the roots for that particular n? For example,
for n=-1:1:1
co_poly=[1 n 0 0 -1];
roots(co_poly)
end
2 comentarios
Geoff Hayes
el 13 de Mzo. de 2016
Why can't you use for? Does the assignment prevent you from using that?
La pregunta está cerrada.
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!