Taylor series while loop

1 Ansicht (letzte 30 Tage)
George  Zimbodia
George Zimbodia am 24 Sep. 2014
Kommentiert: George Zimbodia am 25 Sep. 2014
Thanks for the help!

Akzeptierte Antwort

Guillaume
Guillaume am 24 Sep. 2014
You code is quite good. You made three error:
  • the sign of term must change at each iteration
  • in term again, the power of x is odd (2*k+1)
term = (-1)^k * x^(2*k+1)/factorial(2*k+1);
  • Pn is the result you're calculating. It's what you want to display, not term.
  1 Kommentar
George  Zimbodia
George Zimbodia am 25 Sep. 2014
Thank you! and I forgot to change the disp(term) to disp(Pn) on my original question even though I had did so on my code!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Loops and Conditional Statements finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by