Answered step by step
Verified Expert Solution
Question
1 Approved Answer
The Maclaurin series expansion for the cosine function is: where x is in radians. This function can be used to approximate the cosine of x
The Maclaurin series expansion for the cosine function is:
where x is in radians. This function can be used to approximate the cosine of x with increasing accuracy as terms are added to the summation. Write a function that accepts two scalar inputs in order:
A value for x in radians for the series approximation of cosx
The number of terms, N to be uses in the approximation.
Your function should generate the following three outputs in order:
A column vector of the first N terms summations. Consider the first summation to be the second summation to be
A column vector of relative approximate error The relative approximate error is calculated using present approximation previous approximation present approximation not in percentage Note: use the relative approximate error to be for the first iteration, since there is no "previous approximation".
A column vector of the relative true error The relative true error is calculated using true value present approximation true value. Use MATLAB's builtin cosine function for the true value.
Supplemental Deliverables points:
For supplemental deliverables, you do not need to run your code in Matlab Grader. You have to turn in a hard copy of what is asked.
Utilizing this function you wrote and run your code on Matlab for the following condition. Set up a while loop to evaluate by continue adding terms until the relative approximate error to be less than Print out the number of terms, N
Also print your output with columns of numbers. First column is your approximation, second column is the relative approximate error. Third column is the relative true error. The number of rows will be determined by the stopping criteria of relative approximate error to be less than
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