simple coding, how to write (x-1)...(x-n)
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
How would i write (x-1)(x-2)....(x-n)
for a given n in matlab
0 Kommentare
Antworten (2)
Image Analyst
am 5 Sep. 2016
Try this:
result = 1
for k = 1 : n
result = result * (x - k);
end
2 Kommentare
Image Analyst
am 5 Sep. 2016
You can do this:
result = 1
for k = 1 : length(z)
result = result * (x - z(k));
end
Siehe auch
Kategorien
Mehr zu Loops and Conditional Statements finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!