How can I coding this function correctly?

4 Ansichten (letzte 30 Tage)
Bi Nguyen
Bi Nguyen am 26 Sep. 2020
Kommentiert: Walter Roberson am 26 Sep. 2020
Write a function called Harmonic Sum.The input to this function is a single number, n. The function will return the value 1 + 1/2 + 1/3 + ... + 1/n.
  1 Kommentar
Walter Roberson
Walter Roberson am 26 Sep. 2020
hint: you get more accuracy if you add starting from 1/n instead of from 1/1

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Ameer Hamza
Ameer Hamza am 26 Sep. 2020
Since this is a homework question so I won't be giving exact code, but you can read the documentation of the following functions.

Kategorien

Mehr zu Get Started with MATLAB finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by