how to write a geometric series in command window

65 Ansichten (letzte 30 Tage)
Sami Ahmed
Sami Ahmed am 8 Sep. 2022
Beantwortet: David Hill am 8 Sep. 2022
How do I write a vector that follows the geometric form: 1, 3, 6, 9...
  10 Kommentare
Sami Ahmed
Sami Ahmed am 8 Sep. 2022
ya ive got that thanks
Torsten
Torsten am 8 Sep. 2022
But note that you need 1 as first term followed by 99 terms of the form 1/(3*i).
1./(3:3:300) gives 100 terms of the form 1/(3*i).

Melden Sie sich an, um zu kommentieren.

Antworten (2)

KSSV
KSSV am 8 Sep. 2022
a = 1 ;
r = 2 ;
n = 0:9 ;
gp = a*r.^n
gp = 1×10
1 2 4 8 16 32 64 128 256 512
  4 Kommentare
Sami Ahmed
Sami Ahmed am 8 Sep. 2022
i really dont know, my assignment is asking to create the vector: 1, 3, 6, 9
Torsten
Torsten am 8 Sep. 2022
This is not a geometric sequence.
For a geometric sequence, the quotient of two subsequent members of the sequence must be constant:
a(n+1)/a(n) = q = const. for every n.
In your case:
a2/a1 = 3
a3/a4 = 2
a5/a4 = 1.5
so the quotient is always different.

Melden Sie sich an, um zu kommentieren.


David Hill
David Hill am 8 Sep. 2022
sum(1./[1,3:3:297])
ans = 2.7258

Produkte


Version

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by