필터 지우기
필터 지우기

finding nth value of formula with conditions

조회 수: 1 (최근 30일)
asaf omer
asaf omer 2020년 5월 1일
댓글: KSSV 2020년 5월 1일
hello,
can u guys please help me finding nth value by using the next formula:
a(0)=2
a(1)=3
a(n)=(1-a(n-1))/a(n-1) +a(n-2)
thanks!

답변 (1개)

KSSV
KSSV 2020년 5월 1일
편집: KSSV 2020년 5월 1일
n = 10 ; % size of the array
a = zeros(n,1) ; % Initialize the array
a(1)=2 ; % value at n = 1
a(2)=3 ; % value at n = 2
% loop to get each value
for i = 3:n
a(i)=(1-a(i-1))/a(i-1) +a(i-2) ; % the formula you have given
end
  댓글 수: 2
asaf omer
asaf omer 2020년 5월 1일
thanks a lot , can u please teach how you did that?
KSSV
KSSV 2020년 5월 1일
I have commented the steps......thanks is accepting the asnwer. :)

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

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by