An efficient way to compute many sums with different number of terms
3 ビュー (過去 30 日間)
古いコメントを表示
Suppose I have 2 functions
and
.
Given different values of
, define
, define
and
.For each
, I want to compute the sums
(if
) or
(if
) where
and ϵ are given.
, I want to compute the sums
) or
) where
and ϵ are given. The number of terms
varies across elements. For example,
varies across elements. For example,
I have
then I need to compute 10 terms which are
or
then sum them up.
I have
or
then sum them up.If the number of terms are all the same, i.e.,
, then I think I can vectorize and handle the computation. However, since the length of the sums are not the same, it becomes more difficult for me to handle it efficiently.
, then I think I can vectorize and handle the computation. However, since the length of the sums are not the same, it becomes more difficult for me to handle it efficiently.Can you help me to compute this in an efficient way?
Thank you very much in advance.
0 件のコメント
回答 (1 件)
参考
カテゴリ
Help Center および File Exchange で Startup and Shutdown についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!