Calculating the integral and it's 20-th term

조회 수: 1 (최근 30일)
Michal Waligora
Michal Waligora 2020년 2월 6일
답변: EmielH 2020년 2월 7일
Dear Guys,
I want to formulate the following into a code. I want to calculate the values of I from 1 to 20. Where I know that for the
So I created the following code,
e = 2,7182818284590452353602874713527;
i(n==0)=e-1;
for n =1:20
i(n+1) = e-n*i(n)
end
I had no idea how to put the value of n=0 so I just totally improvised. Code created some values, but not the right ones. If you could spot the mistakes.
Thank you

채택된 답변

EmielH
EmielH 2020년 2월 7일
i=zeros(1,21);
i(1) = exp(1)-1;
for n=1:20
i(n+1) = e-n*i(n);
end

추가 답변 (0개)

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by