How can i keep the results of for loop iteration in every step

조회 수: 3 (최근 30일)
Zuy
Zuy 2018년 10월 29일
댓글: Zuy 2018년 10월 29일
I am trying to calculate a sum series. Series upper limit chance btw 4:2:16 and i want to keep for loop iterations in an array cause i will make a plot N vs Stot.
syms j
for N=4:2:16
S(i)=(symsum(cos((20*pi*j)/(N+1)),j,0,N))
Stot=(2*pi/(N+1))*S;
double(Stot)
end

채택된 답변

KALYAN ACHARJYA
KALYAN ACHARJYA 2018년 10월 29일
편집: KALYAN ACHARJYA 2018년 10월 29일
use
slot(i)=(2*pi/(N+1))*S;
Example:
for i=1:10;
k(i)=2+i;
end
Command Window
>> k
k =
3 4 5 6 7 8 9 10 11 12
  댓글 수: 6
Zuy
Zuy 2018년 10월 29일
i am using S1 formula. İ want to chance N like N=4:2:16 it is 10 in this case but at the same time i want to keep all of summation results in an array cause i will make a plot from them.

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

추가 답변 (0개)

카테고리

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