Use symsum with non-integer step?

9 Ansichten (letzte 30 Tage)
Stephen Jackson
Stephen Jackson am 30 Mär. 2016
Beantwortet: Walter Roberson am 31 Mär. 2016
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;

Antworten (1)

Walter Roberson
Walter Roberson am 31 Mär. 2016
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;

Kategorien

Mehr zu Mathematics 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!

Translated by