Answered step by step
Verified Expert Solution
Question
1 Approved Answer
3. The cosine function: The cosine function can be evaluated by the following infinite series 4 (i coSx1 46! (a) Write a function that needs
3. The cosine function: The cosine function can be evaluated by the following infinite series 4 (i coSx1 46! (a) Write a function that needs as an input the number of terms n of the cosine series and the value ofx and then it calculates the series up to the nh term. (b) Upgrade the function to calculate and store the value of the true percent relative error for each value of k from k-1 to k-n where n is the number of terms given by the user (c) Upgrade your function to plot the true percent relative error for each value of k from k-1 to k- n. Label the x-axis, the y-axis and add a legend. (d) Upgrade your code to time itself and run the code for x- and n-170 and report the final plot, and the time of the calculation. From the MATLAB figure window, change the x-axis and y-axis to appear in logarithmic scale instead of linear scale (that is change the plot into log-log scale). Attach the figure with your solutions (e) From your log-log plot in part (d), how many terms are enough to reach percent relative error less than 1013% (f) If you look at the series, there is an issue in using 200 terms or more in the series. What is the issue
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started