필터 지우기
필터 지우기

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 (최근 30일)
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

채택된 답변

Stalin Samuel
Stalin Samuel 2015년 12월 8일
a1 = ones(10,1);
a(1) =2;
for i = 2:10
a(i) = a(i-1)*2;
end
format rat
a1./a

추가 답변 (1개)

Walter Roberson
Walter Roberson 2015년 12월 8일
To print the array stored in GS:
disp(GS)

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by