MATLAB CODE---------------------------
x=input('Enter value of x');
x1=(x*pi)/180;
COS2x_Actual=cosd(2*x)
n=0;
Error=1;
COS2X_estimated=0;
while (Error>0.0001)
COS2X_estimated =COS2X_estimated +(((-1)^(n)*((2*x1)^(2*n)))/factorial(2*n))
Error = abs(COS2x_Actual-COS2X_estimated)
n=n+1;
end
fprintf('\n\n%d terms are needed to meet the tolerance',n)
OUTPUT----------------TEST---------------------OF-----------CODE
Enter value of x> 45 COS2x_Actual = 0 COS2X_estimated = 1 Error = 1 COS2X_estimated = -0.23370 Error = 0.23370 COS2X_estimated = 0.019969 Error = 0.019969 COS2X_estimated = -8.9452e-04 Error = 8.9452e-04 COS2X_estimated = 2.4737e-05 Error = 2.4737e-05 5 terms are needed to meet the tolerance
Enter value of x> 5 COS2x_Actual = 0.98481 COS2X_estimated = 1 Error = 0.015192 COS2X_estimated = 0.98477 Error = 3.8624e-05 2 terms are needed to meet the tolerance
X) -1-2! +41-614 (2k)! k=0 he actual Write a script that will determine how many terms are needed...