필터 지우기
필터 지우기

skip counting numbers and including the remainder

조회 수: 3 (최근 30일)
CLARK KENDRICK GO
CLARK KENDRICK GO 2018년 4월 7일
댓글: kanagaratnam jeyaneepan 2018년 4월 16일
I want to skip count 1 to 100 by 4's.
So
1:4:100
The output is until 97. I want to include the 100 in the result.
Example: 1:8:88 gives a result until 81. I want to include 88.
How do I do this? Thanks
  댓글 수: 1
kanagaratnam jeyaneepan
kanagaratnam jeyaneepan 2018년 4월 16일
I did not get my expected answer. I belive problem cumpsum() %Maclaurian Series for exp(0.1) n = 5; a = 0.01;
vec = [1:n]; terms = a.^vec/cumprod(vec); expVal = 1 + cumsum(terms); trueVal = exp(0.1); err = abs(trueVal - expVal);

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

채택된 답변

Andrei Bobrov
Andrei Bobrov 2018년 4월 7일
편집: Andrei Bobrov 2018년 4월 7일
n = 100;
step1 = 4;
seq = unique([1:step1:n,n]);

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Time Series Collections에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by