Can someone help me write this into a series?
Show older comments
S=2*r^3 + 4*r^5 + 6*r^7+ 8*r^9 + ... + (2n)*r^(2n+1)
Answers (3)
r = pi;
n = 4;
S = sum((2:2:2*n).*r.^(3:2:2*n+1))
Or
r = pi;
n = 4;
v = 2:2:2*n;
sum(v.*r.^(v+1))
5 Comments
Zackary Fillbrandt
on 8 May 2020
Im having problems with an assiengment i was given for a Into to BME course:
i have to add this equation "(n(n+1))/2" into matlab without a while loop. so that my saved file "mysum2(n)" represents;
>> mysum2(5)
ans =
15
Stephen23
on 8 May 2020
@Zackary Fillbrandt: what have you tried so far?
Zackary Fillbrandt
on 8 May 2020
funtion total = mysum2 (n)
total=0;
n=1;
while n ~= -1
total = ((n) * (n+1)) / 2
end
end
I knew my set up was wrong befor i entered it into the command window, but i was trying to use the 1 exursice as a starting point, but i knew it couldnt be that easy. the other function was as follows:
function total = mysum(n)
total = 0;
i = 1;
while i <= n
total = total + i;
i = i + 1;
end
end
Stephen23
on 8 May 2020
I don't see why you need any loop:
>> n = 5;
>> (n*(n+1))/2
ans = 15
Zackary Fillbrandt
on 9 May 2020
thank you Steven, I'm not sure if what i did to acamplish my is what you ment, but just you saying that clicked on the light buld and i was able to salve the exercise. this is what i put:
function total = mysum2 (n)
total = 0
i = 1;
while i <= n
i = (n + 1);
total = n * i;
totalt = total / 2;
end
end
whith this i was able to create my 'mysum2.m' function and complete the exercise. so that you so much Steven
KALYAN ACHARJYA
on 3 Nov 2018
Edited: KALYAN ACHARJYA
on 3 Nov 2018
syms r
n=input('Enter the n number ');
s=0;
for n=1:n;
s=2*n*r^(2*n+1)+s;
end
disp(s);
1 Comment
Zackary Fillbrandt
on 8 May 2020
Im having problems with an assiengment i was given for a Into to BME course:
i have to add this equation "(n(n+1))/2" into matlab without a while loop. so that my saved file "mysum2(n)" represents;
>> mysum2(5)
ans =
15
madhan ravi
on 3 Nov 2018
You can tell whether the series diverges or converges by the below
syms r n
SERIES=symsum((2*n)*r^(2*n+1),n,1,inf);
fplot(SERIES)
2 Comments
madhan ravi
on 3 Nov 2018
Or you can try the following if you want to see numbers as the sum:
syms r
rvalue = input('r value ? ')
n1 = input('nth term ? ')
n=1:n1;
SERIES=sum((2.*n).*r.^(2.*n+1)) %to see series in symbolic form like your question
SERIES=vpa(subs(SERIES,r,rvalue),3) %to see number with three decimal places
Zackary Fillbrandt
on 8 May 2020
Im having problems with an assiengment i was given for a Into to BME course:
i have to add this equation "(n(n+1))/2" into matlab without a while loop. so that my saved file "mysum2(n)" represents;
>> mysum2(5)
ans =
15
Categories
Find more on Time Series Events 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!