this is my programme
for k=1:10
x(k)=sin(k)
end
now i want to add all the 10 values together

 Réponse acceptée

Azzi Abdelmalek
Azzi Abdelmalek le 9 Sep 2013
Modifié(e) : Azzi Abdelmalek le 9 Sep 2013

0 votes

If you mean to sum all the values use
for k=1:10
x(k)=sin(k)
end
out=sum(x)
%or without a for loop
k=1:10
x=sin(k)
out=sum(x)

Plus de réponses (0)

Catégories

En savoir plus sur Loops and Conditional Statements dans Centre d'aide et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by