Can someone help me write this into a series?

조회 수: 3 (최근 30일)
Pablo Garcia
Pablo Garcia 2018년 11월 3일
댓글: Zackary Fillbrandt 2020년 5월 9일
S=2*r^3 + 4*r^5 + 6*r^7+ 8*r^9 + ... + (2n)*r^(2n+1)

답변 (3개)

Stephen23
Stephen23 2018년 11월 3일
편집: Stephen23 2018년 11월 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
Stephen23
Stephen23 2020년 5월 8일
I don't see why you need any loop:
>> n = 5;
>> (n*(n+1))/2
ans = 15
Zackary Fillbrandt
Zackary Fillbrandt 2020년 5월 9일
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
KALYAN ACHARJYA 2018년 11월 3일
편집: KALYAN ACHARJYA 2018년 11월 3일
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
Zackary Fillbrandt
Zackary Fillbrandt 2020년 5월 8일
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
madhan ravi 2018년 11월 3일
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
madhan ravi
madhan ravi 2018년 11월 3일
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
Zackary Fillbrandt 2020년 5월 8일
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

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Mathematics에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by