Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Need help with MATLAB homework, will require utilizing online version of MATLAB 3 Taylor Series in MATLAB (25 points) The function f(x)=cos(x) can be represented

Need help with MATLAB homework, will require utilizing online version of MATLAB
image text in transcribed
3 Taylor Series in MATLAB (25 points) The function f(x)=cos(x) can be represented in a Taylor series as follows (where x is in radians): cos(x)=12!x2+4!x46!x6+=n=0(2n)!(1)nx2n=n=0an Write a function file cosTaylor.m that computes the value of cosx using this Taylor series. The function takes the input x in radians and return cos(x) approximation as output. functioncosx=cosTaylor(x) The program should use a loop structure to add each term of the summation. If an is the nth term in the series, the sum Sn of the n terms is Sn=Sn1+an. In each loop iteration calculate the estimated error E given by: E=Sn1SnSn1 Repeat the loop until E is smaller than 0.00001 OR the number of terms that have already been added is not greater than 30 . The function should print on screen the number of terms used in the summation when the loop ends. - Report the MATLAB script file and the output of following function calls: cosTaylor (pi/4), cosTaylor (17pi/5), and cosTaylor (22) - Compare the outputs against the cos ( ) function which is predefined in MATLAB: cos(Mi/4), cos(17pi/5), and cos(22). Hint: Use while-end loop. You may use break keyword if needed and the factorial () function to calculate the denominator (2n)! in an

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

Main Memory Database Systems

Authors: Frans Faerber, Alfons Kemper, Per-Åke Alfons

1st Edition

1680833243, 978-1680833249

More Books

Students also viewed these Databases questions

Question

What is the Definition for Third Normal Form?

Answered: 1 week ago

Question

Provide two examples of a One-To-Many relationship.

Answered: 1 week ago