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

3 vues (au cours des 30 derniers jours)
Zuy
Zuy le 29 Oct 2018
Commenté : Zuy le 29 Oct 2018
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

Réponse acceptée

KALYAN ACHARJYA
KALYAN ACHARJYA le 29 Oct 2018
Modifié(e) : KALYAN ACHARJYA le 29 Oct 2018
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 commentaires
Zuy
Zuy le 29 Oct 2018
Zuy
Zuy le 29 Oct 2018
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.

Connectez-vous pour commenter.

Plus de réponses (0)

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!

Translated by