Answered step by step
Verified Expert Solution
Question
1 Approved Answer
1. The sine function can be evaluated by its Taylor's series: sinx=x3!x3+5!x5 where x is in radians. Write a user-defined function that determines sinx using
1. The sine function can be evaluated by its Taylor's series: sinx=x3!x3+5!x5 where x is in radians. Write a user-defined function that determines sinx using Taylor's series expansion. For function name and arguments, use y= sinTaylor (x), where the input argument x is the angle in degrees and the output argument y is the value for sinx. Inside the user-defined function, use a loop for adding the terms of Taylor's series. If an is the nth term in the series, then the sum Sn of the n terms is Sn=Sn1+an. In each loop, calculate: - the absolute true error ea=sin(x)f(x) - the relative true error er=sin(x)ea - the relative approximate error e=f(xcurrent)f(xcurrent)f(xprevious) where f(x) is your approximation of the sine function. For the true value of sinx, use MATLAB embedded function sin. Stop adding terms when e106. Use sinTaylor for calculating sin25 and sin195. Discuss the observation in your submission
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