Question: You have been tasked with developing an M-file that allows other engineers to quickly determine the maximum n needed to reduce the truncation error below
You have been tasked with developing an M-file that allows other engineers to quickly determine the maximum n needed to reduce the truncation error below an error threshold. The truncation error is the absolute error between the approximation and MATLABs cos() function. Your code should do the following: 1) Ask the user for an error threshold value
2) Find the number of terms needed so that the truncation error is always below the user error threshold from x = -2 to 2
3) Print the number of terms needed, the mean truncation error and the maximum truncation error using fprintf
4) Plot the truncation error against x
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
