simple coding, how to write (x-1)...(x-n)
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
How would i write (x-1)(x-2)....(x-n)
for a given n in matlab
0 Commenti
Risposte (2)
Image Analyst
il 5 Set 2016
Try this:
result = 1
for k = 1 : n
result = result * (x - k);
end
2 Commenti
Image Analyst
il 5 Set 2016
You can do this:
result = 1
for k = 1 : length(z)
result = result * (x - z(k));
end
Vedere anche
Categorie
Scopri di più su Loops and Conditional Statements in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!