create function that performs the following computation
Infos
Cette question est clôturée. Rouvrir pour modifier ou répondre.
Afficher commentaires plus anciens
S=N = 1+1/2+1/3+1/4+.........1/N
Σ
K =1
1 commentaire
Anusha Sridharan
le 27 Déc 2018
[Answers Dev] Restored Edits
Réponses (1)
KALYAN ACHARJYA
le 3 Oct 2018
function sum_result=sum1(n)
sum1=0;
for i=1:n
sum1=sum1+1/n;
end
end
Same can be done by using while loop also. It someone using indexing, it would be better.\
Learn Matlab by doing
Cette question est clôturée.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!