Hey People :) Im trying to using a for loop to create and print an array of a Geometric Serise that stores the first 10 terms of the sequence that halves each time i.e. {1/2, 1/4, 1/8, 1/16, ... 1/1024 }
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Zachary Holmes
le 8 Déc 2015
Réponse apportée : Stalin Samuel
le 8 Déc 2015
My method obviously is to use a for loop but my problem is printing the array.
Could somebody please write a script to help me
Thanks
0 commentaires
Réponse acceptée
Stalin Samuel
le 8 Déc 2015
a1 = ones(10,1);
a(1) =2;
for i = 2:10
a(i) = a(i-1)*2;
end
format rat
a1./a
0 commentaires
Plus de réponses (1)
Voir également
Catégories
En savoir plus sur Loops and Conditional Statements dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!