Problem 1: Make Your Own Trig Functions MATLAB of course has built-intrig functions. But before that was common on calculators, one way to find a trig value was through an infinite series. For example, the value of cos can be found from an infinite series of the form cos(x) = 1-5 - -- Notice that this formula has an infinite number of terms with even powers of an alternating signs for each term. N denotes the factorial, defined as the product of integer and all integers below it. For emple, 3 3.2.16 . Implement the formula oververal part Part 1: MyFactorial While Matlab has a built-in function factorial in this problem you will write your own. The first line of the function should be function Factorial - myFactorial in) Check to make sure that calling My Factorial wid t urns number 6 the command window type my Factor3 d you should get ans - 61 You can check this in Like the built-in Matlab function, your code should return as the answer (nFactorial) for If the input is negative, or if it is not the function should return (nFactorial should equal) NaN (feel free to see what the built-in factorial does in those cases) You can write this function with a loop or using vector math (and built-in vector functions), just do not use the built-in factorial function Comment your code! Part 2: Cesine expansion code Now we'll do the cos approximation equation infinite series above), first for a given number of terms. Write a function whose first lines function cox - CosApproxNterms ix, Terms) where x is the input value for which you want to estimate Con Terms is the number of terms to include in the estimate, and coexis the computed estimate As in the equation above using terms should include terms up to ( 3) . This code should call your function My Factorial For the cosine expansion, the sign of the terms keeps changing. To get ideas for how to program this, think about what you get for the sequence (-1).(-1).-19. 1 Note this is an intentionally) somewhat age into a specific recipe for what you should code! Create a script called CosApproxiterms error do some calculations using your function. This script should call cos. Approxiters with appropriate inputs and collecting appropriate o uts) to swer the following to Answer them in comments in this script What is the difference between cox your approximation and cosx) exact values, using MATLAB's built in function) foro Does it m er how many terms (value of nes) you use? b. What is the difference between cos co fors-pi2 using 10 terms? Using 100 terms? Will this ever equal exactly O? How many terms are you comfortable with for this approximation? Does it depend on ? d Use to see how long your function takes compared to MATLAB' s) Is it considerable? How does it depend on Terms