for loop to make a taylor series

1 回表示 (過去 30 日間)
SonOfAFather
SonOfAFather 2012 年 9 月 6 日
編集済み: henry joe 2015 年 4 月 12 日
I am trying to make a taylor series for e^x where
e^x = 1+(X/1!)+((X^2)/2!)+((X^3)/3!)+...
and the approximation is sum set n-1 over k=0 f(x)=(x^k)/k!
I know that the k = input('number of terms: '); and x = input('value of "x":');
I know that i can use the factorial(k) as a portion of the approxamation section of this script.

採用された回答

Matt Fig
Matt Fig 2012 年 9 月 6 日
編集済み: Matt Fig 2012 年 9 月 6 日
If you write it as:
e^x = x^0/0! + x^1/1! + x^2/2! + .... + x^n/n!
then you can see the pattern easier.
I don't want to do your homework for you, but look at this hint:
T = 0; % Initial value of T.
for ii = 0:3
T = T + ii; % Easy to change this to meet your needs...
end
T % Show new value of T. Compare to 0+1+2+3
  1 件のコメント
SonOfAFather
SonOfAFather 2012 年 9 月 6 日
thank you I dont want anyone to actually do my homework but was trying to give all the specifics i could to get some guidance into where the answer lies. thank you for your information.

サインインしてコメントする。

その他の回答 (1 件)

henry joe
henry joe 2015 年 4 月 12 日
編集済み: henry joe 2015 年 4 月 12 日
A new to matlab

カテゴリ

Help Center および File ExchangeSymbolic Math Toolbox についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by