Use symsum with non-integer step?

7 ビュー (過去 30 日間)
Stephen Jackson
Stephen Jackson 2016 年 3 月 30 日
回答済み: Walter Roberson 2016 年 3 月 31 日
Is it possible to use symsum with a non-integer step? If not, what is a summation work around for using non-integer steps in order to sum over a function?
Here is what I currently have. This is part of a double summation, but the second summation done has it's bounds set by the value of the first summation bounds so I had to use a for loop on that first summation. If you have any input on how to better do the double summation on this, feel free to share.
nn = 0:step:Nmax;
for z = 1:length(nn)
in = L(i)-abs(N(j)-nn(z));
ll = L_le:step:abs(in);
Ll = 0;
func = sqrt((L(i) - Ll + 0.5).^2-(N(j) - nn(z) - 0.5).^2)/((L(i) - Ll + 0.5).*(N(j) - nn(z) - 0.5))...
- sqrt((L(i) - Ll + 0.5).^2-(N(j) - nn(z) + 0.5).^2)/((L(i) - Ll + 0.5).*(N(j) - nn(z) + 0.5));
R = symsum(func,Ll,ll)*A(j,i)*B(j,i)*C(j,i)*Cp(j,i) + R;

回答 (1 件)

Walter Roberson
Walter Roberson 2016 年 3 月 31 日
No, the underlying symbolic engine only accepts integer steps.
Use integer indices but replace the variable with a function of the index variable that return the appropriate value. For example,
LL = @(IDX) L_e + (IDX-1) * step;

カテゴリ

Help Center および File ExchangeMathematics についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by