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

I am currently having trouble figuring out a code to use on matlab. I have resea

ID: 1720005 • Letter: I

Question

I am currently having trouble figuring out a code to use on matlab. I have researched and looked through textbooks to no avail.

In matlhematics, a Taylor scrics expansion is a representation of a function as an infinite sum of terms which is accurate near a point a. The general form of the Taylor series is: oc f(n) rt n=0 When a = 0, the Taylor series is also called a Maclaurin series. The Maclaurin series for sin() is sin (z) sin(x) = x-3! + 5!' From the computing perspective, the more terms you have in the summation, the more accurate your result will be to the real value. Please write a Matlab pr that uses the Maclaurin series for computing sin (T/9) with tolerance 10-5. Also, figure out from your code how many terms were needed in your series to achieve the tolerance.

Explanation / Answer

clear

clc

n = input('Enter number of iiterations (n): ' );

x = pi/9;

y = zeros(1,n);

end

SINx = sum(y);

NOTE:{x=(pi/9); sin(x)=x-((x^3)/(1:3))+((x^5)/(1:5))-((x^7)/(1:7));}

Checkout:That a code for a Maclaurin series that will compute sin(pi/9) to a tolerance of 10^-5. The above code works,

But the question is how would you use variables (and possibly a loop?) to add an endless number of terms without typing them all out. During typing, there is an error in the house. Perhaps you wanted to write the product of those terms. Or perhaps you thought that dividing a scalar by a vector would somehow divide the numerator by each of those terms in order, and return one result.