Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a function m-file to calculate the approximated cosine function which can be evaluated by the following infinite series - equation cos x = 1

Write a function m-file to calculate the approximated cosine function which can be evaluated by the

following infinite series - equation

cos x = 1 - ( x2/2! ) + ( x4/4! ) - ( x6/6! ) + ..... + ((-1)(n+1)x2(n-1))/(2(n-1))!

Here are requirements for the function m-file.

- Parameter lists (inputs): x value (in radian), and desired error percentage. If the real error per-

centage is less than the desired error percentage, the loop (addition) will stop.

- Return value (outputs): approximated value, real error percentage, and number of iterations

- Function name: Approx_Cos_yourEmailAccount

Using a script m-file which will call the Approx_Cos_yourEmailAccount function, save outputs with following given inputs.

- x = pi/12 and %error = 1%. Save it on EX1_11.dat

- x = pi/12 and %error = 0.1%. Save it on EX!_12.dat

- x = pi/6 and %error = 1%. Save it on EX1_13.dat

- x = pi/6 and %error = 0.1. Save it on EX1_14.dat

- x = pi/6 and %error = 0.01%. Save it on EX1_15.dat

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

The Accidental Data Scientist

Authors: Amy Affelt

1st Edition

1573877077, 9781573877077

More Books

Students also viewed these Databases questions