Question: Question 1 ( 5 0 marks ) : For the following Maclaurin series: c o s x = n = 0 ( - 1 )
Question marks:
For the following Maclaurin series:
cdots
i Write a MATLAB function, named myfun, that will accept and as inputs and produce one output, corresponding to the approximated value of given in the equation above. You must use forloops.
ii Test your function for and and store the result in a variable named testfun.
iii. For call the fun function six times, corresponding to and Use a forloop to solve this part and store the result of the function calls in an array named test fun.
iv Plot a bar graph showing the absolute error difference between the results for all calls and the actual value of Add a descriptive title and labels.
v Compare your performance for both functions using Call each function times and time them using the commands tic and toe.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
