simple coding, how to write (x-1)...(x-n)
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
How would i write (x-1)(x-2)....(x-n)
for a given n in matlab
0 commentaires
Réponses (2)
Image Analyst
le 5 Sep 2016
Try this:
result = 1
for k = 1 : n
result = result * (x - k);
end
2 commentaires
Image Analyst
le 5 Sep 2016
You can do this:
result = 1
for k = 1 : length(z)
result = result * (x - z(k));
end
Voir également
Catégories
En savoir plus sur Loops and Conditional Statements dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!