skip counting numbers and including the remainder
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
CLARK KENDRICK GO
am 7 Apr. 2018
Kommentiert: kanagaratnam jeyaneepan
am 16 Apr. 2018
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 Kommentar
kanagaratnam jeyaneepan
am 16 Apr. 2018
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);
Akzeptierte Antwort
Andrei Bobrov
am 7 Apr. 2018
Bearbeitet: Andrei Bobrov
am 7 Apr. 2018
n = 100;
step1 = 4;
seq = unique([1:step1:n,n]);
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Multidimensional Arrays finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!