Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Refer to the attached file The values of sin(x) and cos(x) can be approximated by the following Taylor series: sin (x) = x - x^3/3!

Refer to the attached file image text in transcribed
The values of sin(x) and cos(x) can be approximated by the following Taylor series: sin (x) = x - x^3/3! + x^5/5! - x^7/7! + ...... cos(x) = 1- x^2/2! + x^4/4! - x^6/6! + ...... Or in compact forms, sin(x) = sigma^infinity _k = 1 (-1)^k+1 x^2k - 1/(2k - 1)! cos(x) = sigma^infinity _k = 1(- 1)^k-1 x^2(k-1)/(2(k-1))! Recall the symbol ! stands for factorial. The more terms you have in the series, the more accurate the approximation for the values of sin(x) or cos(x). However, it is not necessary or not possible to include an infinite number of terms to calculate their values. Start with the first two terms in the summation series. Then, add an additional term Into the series one by one. When the absolute difference between the new summation and the previous summation (without the new term) is less than 0.001, you can stop and obtain an approximate value for sin(x) or cos(x). Write a MATLAB script that follows the above algorithm to estimate the values for sin (x) and cos(x) for x in the range of [0,4 pi]. Your script should also generate a graph with two subplots side by side, showing x versus the approximate results of sin(x) and cos(x) you obtained from the above algorithm with red circle markers. At least 20 values of x should be considered in the approximation. Then, in each subplot, draw another blue dashed curve for x versus the exact values of sin(x) and cos(x), which are calculated by the MATLAB built-in function sin() and cos(x), respectively. The same x values should be considered here as above. You need to title and label your plot properly. A legend should be included to distinguish the approximate results and exact results

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions