Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Create a script m-file, IMPLEMENTING A WHILE LOOP, that will display the functio

ID: 3749520 • Letter: C

Question

Create a script m-file, IMPLEMENTING A WHILE LOOP, that will display the function
y(t) = e^x and simultaneously use the Taylor series to show the convergence after
each polynomial until the 10th degree Taylor polynomial.
Hint: T = T + xj/j!

USING THE WHILE LOOP IN MATLAB.

3. Create a secript m-fle, implementing a a while loop, that will display the function vhile lop, that will display the function y(t) and simultaneously use the Taylor series to show the convergence after each polynomial until the 10th degree Taylor polynomial. Hint: T-T+

Explanation / Answer

The MATLAB code for the problem is provided below, the "x" value has to be set, here x=2 is used, please comment if any doubts:

%set the value of x
x = 2

i=1;
T=1;

%while i less than 10
while (i<11)
disp('Taylor polynomial of degree ')
i
disp('e^x')
exp(x)
  
%set the value of T
T=T+(x.^i)/factorial(i)
i=i+1;
end

Output:

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote