Can I use a vector as the lower bound index of my summation?

I'm trying to plot the sum of 1/(k-1) from k=s+1 to 100, where s is the independent variable, ranging from 1 to 99. Currently, I have:
s=(1:99);
plot(s, symsum(1/(k-1),s+1,100))
This gives me the following error: Operands to the and && operators must be convertible to logical scalar values.
Error in sym/symsum (line 109) if isnan(a) isnan(b)
Is there a way to do this? Thank you!

 Accepted Answer

t=1:99;
syms s k
y=double(subs(symsum(1/(k-1),s+1,100) ,t) );
plot(t,y)

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!