Hi everyone, can someone help me with this double sum ?
20 ビュー (過去 30 日間)
古いコメントを表示
Hi everyone, I am struggling on how to write this double sum in matlab, hoping someone can help me:
thanks in advance !!
1 件のコメント
回答 (1 件)
John D'Errico
2022 年 10 月 7 日
編集済み: John D'Errico
2022 年 10 月 7 日
Surely you can use a loop? Actually just nested loops? Perhaps your problem is MATLAB does not allow a zero index, yet you have what would seem to be a zero index.
Next, are those powers of S and T?
Anyway, all you need to do is
ThisSum = 0;
for j = 0:4
for i = 0:4-j
ThisSum = ThisSum + a(i+1,j+1)*T^i*S^j;
end
end
I assume that a is an array, since you have what apear to be indices. And a would need to be a 5x5 array.
Are there other ways to solve this? Well, yes. Do you need them? NO.
2 件のコメント
John D'Errico
2022 年 10 月 8 日
How would I know either? Your formula refers to an array that appears to have TWO indices, i and j. But you tell us that a is just a 1x15 vector. Without knowing what the elements of a are, or what they mean, they are just a list of numbers. Perhaps it really was an array, in some unrolled form. But without knowing exactly what a contains, or why it is that shape, we are left with no answer. A list of numbers contains no meaning associated with it. The meaning can only be derived from the person or programmer that created the list.
That it is a 15 element vector MIGHT be related to the fact that if you took only the upper or lower triangle of a 5x5 array, there would be exactly 15 elements. But that would be pure and wild conjectiure on my part, and I would still not know in which order those elements are taken. I cannot read the mind of the programmer who created this vector.
参考
カテゴリ
Help Center および File Exchange で Matrix Indexing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!