Use symsum with non-integer step?

3 views (last 30 days)
Stephen Jackson
Stephen Jackson on 30 Mar 2016
Answered: Walter Roberson on 31 Mar 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;

Answers (1)

Walter Roberson
Walter Roberson on 31 Mar 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;

Categories

Find more on Mathematics in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!