Largest value n in summation

조회 수: 4 (최근 30일)
Stephan van Kalmthout
Stephan van Kalmthout 2020년 2월 11일
편집: Farhath Fatima 2020년 2월 12일
Hi, I am completely new to Matlab, but I need to find the largest value of n for which the sum of n^(2/3) is less than 1000, by using looping.
Could you please be so kind to specify why things are placed in a certain place/way, so get a better understanding. Thanks on before hand!

답변 (1개)

Farhath Fatima
Farhath Fatima 2020년 2월 12일
편집: Farhath Fatima 2020년 2월 12일
Hi Stephan,
You can go through below code to find the largest value n in a summation.
Assuming ’n’ to be natural numbers.
sum=0;
i=0;
while(1)
if sum<1000
sum=sum+(i^(2/3)) ;
else
sprintf('The largets value of n in summation = %d',(i-1))%prints the value of number if sum is greater than n*(2/3)
break;
end
i=i+1;
end

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

태그

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by