Question: The cosine function can be approximated by a Maclaurin series expansion as: c o s ( x ) = 1 - x 2 2 !

The cosine function can be approximated by a Maclaurin series expansion as:
cos(x)=1-x22!+x44!-x66!+x88!-cdots
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 two output variables.
Generate a column vector of the first N series terms and assign this vector to the variable terms.
Generate a column vector of the first N series summations. The first summation is 1, second is 1-x22!, third is 1-x22!+x44!, and so on. Assign this vector to the output variable seriessums.
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.
IN MATLAB
 The cosine function can be approximated by a Maclaurin series expansion

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!