Maclaurin Series function in matlab

250 ビュー (過去 30 日間)
mohamed
mohamed 2013 年 5 月 17 日
回答済み: Chandra 2023 年 12 月 18 日
e^x=1+x+((x^2)/2!)+((x^3)/3!)+((x^4)/4!)+......
  • Implement a MATLAB function that compute e^x using this formula *(Stop when ((epson)a) is below than an error criterion confirming to five significant figures)
  • You must display your result , the final value of error you reached and the number of terms taken
please help i have to hand this out tomorrow :(
i dont have a problem with the real solving but when it comes to matlab im noob :(
  2 件のコメント
mohamed
mohamed 2013 年 5 月 17 日
移動済み: John D'Errico 2023 年 2 月 3 日
my problem is: the first iteration its gives me 1 2nd iteration gives me 1.5208 but its should be 1.5 please someone help me :(
Hamed Oluwaseyitan
Hamed Oluwaseyitan 2023 年 4 月 17 日
  • Use MATLAB to determine the Maclaurin series of up to and including the term (include a screenshot); and,
use the result to propose what the complete (infinitely many terms) Maclaurin series of might look like. You will need to use (sigma) notation to express your answer
  • Use MATLAB to determine the Maclaurin series of up to and including the term (include a screenshot); and,
  • use the result to propose what the complete (infinitely many terms) Maclaurin series of might look like. You will need to use (sigma) notation to express your answer

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

回答 (4 件)

mohamed
mohamed 2013 年 5 月 17 日
function Maclaurin
n=5;
x=input('enter the x value: ')
epsilon_s=(0.5*10^(2-n))
epsilon=100
maclaurin(1)=1
iteration=1
while epsilon>epsilon_s
iteration=iteration+1
maclaurin(iteration)=maclaurin(iteration-1)+(x)^(iteration-1)+x^(2+(iteration-1))/factorial(2+(iteration-1))
epsilon=abs((maclaurin(iteration)-maclaurin(iteration-1))/maclaurin(iteration))
end
disp(['number of iterations= ',num2str(iteration)])
disp(['epsilon= ',num2str(epsilon)])

Iman Ansari
Iman Ansari 2013 年 5 月 17 日
function Maclaurin
n=5;
x=input('enter the x value: ');
epsilon_s=(0.5*10^(2-n));
epsilon=100;
maclaurin(1)=1;
iteration=1;
while epsilon>epsilon_s
iteration=iteration+1;
maclaurin(iteration)=maclaurin(iteration-1)+(x)^(iteration-1)/factorial(iteration-1);
epsilon=abs((maclaurin(iteration)-maclaurin(iteration-1))/maclaurin(iteration));
end
disp(['e^' num2str(x) ' = ' num2str(maclaurin(iteration))])
disp(['number of iterations= ',num2str(iteration)])
disp(['epsilon= ',num2str(epsilon)])
  2 件のコメント
Lexia Rocco
Lexia Rocco 2017 年 5 月 25 日
I need my estimation for e^x to display 8 digits, I've been trying to figure out the syntax for it although i keep getting errors, do you know how I could change it to display e^x with 8 significant digits? Please and thank you!
Walter Roberson
Walter Roberson 2017 年 5 月 25 日
disp(['e^' num2str(x, '%.8f') ' = ' num2str(maclaurin(iteration))])

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


rana
rana 2023 年 3 月 3 日
Using Matlab Plot the function f(x)= e^x and the Maclaurin’s series expansion Using 6 terms, 8 terms and 10 terms

Chandra
Chandra 2023 年 12 月 18 日
i want the plottings

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by