Question: ** coding in MATLAB!!** Please use the attached sample code to complete this task & use the built in matlab function of cos(x) to compute
The cosine function can be evaluated by the following infinite series (r is in radian): 2k cos(x)-2(-1)" (2kji = 1-21 + -61 + k=0 Step I: Create an M-file and use for loop structure to implement this formula so that it computes nd displays the values of cos(x) as each term in the series is added. In other words, compute and display in sequence the values for 2 cos(x) 1- 2! cos(x) = 1 2! 4! cos(x) = 1--+-- 21 4 6! Up to the order term of your choice. For each of the steps, compute and display absolute true percent relative error as: Error%=abs The value-Approximation value ) 1 00% True value Step 2: Test you program in the following points and write down the value of cos(r and percentage error for each case using 9 term approximation (G.e, up to 16 0.2 09801 0.7 1.25 cos(x) Error%
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
