The cosine function can be evaluated by the following infinite series: The quest
ID: 3783102 • Letter: T
Question
The cosine function can be evaluated by the following infinite series:
The question in the picture
Please explain as much as possible:) Thanks
The cosine function can be evaluated by the following infinite series: x2 x4 x6 cos(x) 1 4-6! a) Write a MATLAB code to implement this formula so that it computes and prints the value of cos using 5 terms of approximation function above. cos(x) -1 (1 term) (2 terms) 2! x 2 x 4 COS (x 1 (3 terms) and so on. Also, compute and display the percent relative error as true Series approximation error X100% true b) What is the type of error resulted from this approximation (Name of the error) c) Plot your solution for cos(x) in MATLAB and attach the plot.Explanation / Answer
function fout=error(x,n)
%x=real value
%n=maximum value
cosValue=1;
k=1;
for j=2:2:n
fact=1;
for i=1:j
fact=fact*i;
end
cosValue=1+(((-1)^k)*((x^j)/fact));
k=k+1;
fout=cosValue;
end
end
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.