simple coding, how to write (x-1)...(x-n)
1 回表示 (過去 30 日間)
古いコメントを表示
How would i write (x-1)(x-2)....(x-n)
for a given n in matlab
0 件のコメント
回答 (2 件)
Image Analyst
2016 年 9 月 5 日
Try this:
result = 1
for k = 1 : n
result = result * (x - k);
end
2 件のコメント
Image Analyst
2016 年 9 月 5 日
You can do this:
result = 1
for k = 1 : length(z)
result = result * (x - z(k));
end
参考
カテゴリ
Help Center および File Exchange で Loops and Conditional Statements についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!