How to reference past values?
조회 수: 5 (최근 30일)
이전 댓글 표시
how do I reference past values of a function?
as in f(x) = 0.7*(f(x-1))
댓글 수: 0
답변 (1개)
Roger Wohlwend
2014년 10월 16일
편집: Roger Wohlwend
2014년 10월 16일
In general you have to use a loop for that. However, in your simple case it is not necessary.
f(x) = 0.7^x * f(0)
where f0 is the inition condition.
So if you want a vector with the first n values of the function, use the following Matlab code:
f = 0.7.^(1:n) * f0
where f0 is the initial condition, a scalar.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Multidimensional Arrays에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!