Question: matlab code 3. (10 points) The Maclaurin series expansion for the cosine function up to some number of terms is given by 4 cos(x) =


matlab code
3. (10 points) The Maclaurin series expansion for the cosine function up to some number of terms is given by 4 cos(x) = 1--+ +- where is the angle in radians and n! = n x (n-1) x (n-2) . . . x 1 denotes the factorial of n. Note that 0! - 1. For example, the cosine approximations for one, two, and five terms can be obtained as follows: COS(2) 1 6 Write a function approxCosineFunction that takes scalar input arguments x and the number of terms t, and returns the approximate value of cos(x). The function is invoked as follows: approx = approxCosineFunction(x, t); Use MATLAB's factorial function to compute the factorial values. Assume that x is in radians. Your code should use MATLABs built-in vector operations to solve this problem. You must not use for and while loops, or MATLAB's cos function. The values returned by MATLAB's cos function, which we will consider the gold standard, for some example values of x are
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
