(Solved):
Using matlab please
Problem 4: Maclaurin Series for Cosine The cosine function can be ...
Using matlab please????
Problem 4: Maclaurin Series for Cosine The cosine function can be approximated by a Maclaurin series expansion as: cos(x)=1?2!x2?+4!x4??6!16?+8!x8??? which can also be written in the following form: cos(x)=?n=0??(2n)!(?1)nx2n? Where x is in radians. This expression can be used to approximate the cosine of x with increasing accuracy as terms are added to the summation. Code has already been provided to define a function named maclaurincosine that accepts input values into the following two variables. - The variable x accepts a value for x (in radians) for the series approximation of cos(x). - The variable N accepts an integer specifying the number of series terms, N, to use in the approximation. Add code to the function to generate the following output variable: - Generate a column vector of the first N series terms and assign this vector to the variable terms.
The first two tests check the results for the second and third series terms respectively to aid in your debugging process. You can also check these values with a hand calculation. Note the values of x and N are defined as inputs to the function. Do not overwrite these values in your code. Be sure to assign values to each of the function output variables. N.B terms starts from index 1 instead of 0 , be sure to revise summation index shifting