The cos(x) function can be represented in a Taylor series shownbelow:
Write a Matlab program, and use a while loop, to calculatecos(150) (the input is in degrees) by adding terms of the seriesand stopping when the absolute value of the term that was addedlast is smaller than 0.0001.
Make sure to make the required degree <-> radianconversions.
Use fprintf to print the cos(150) (up to 2 decimal places) andthe number of terms used to calculate it. Also, calculate and printthe cos(150) using matlab's built-in function cosd. (Your code andthe cosd function should return the same values).
- Create your script in matlab, name it Lab6.m and attach it inthe space below. Your script should have a line of comment withyour name and date and a line with a short description about thecode.