Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

DESCRIPTION The purpose of this assignment is to learn how to use while loops and if statements to solve common mathematical expressions. ASSIGNMENT You must

image text in transcribed

DESCRIPTION The purpose of this assignment is to learn how to use while loops and if statements to solve common mathematical expressions. ASSIGNMENT You must enter your solution into the MATLAB Grader and verify that all assessments are met to receive full credit. Include comments in your code where applicable. PROCEDURE Part 2: Taylor Series Expansion of Cosine (-12-1 C05 ) = Write a script that uses a while loop to estimate the cosine of using the Taylor series expansion until the output is within +/-0.0001 of the actual value returned when using the cosine function in MATLAB. Assign the number of iterations through the while loop as variable n. Script Save C Reset ES MATLAB Documentation 1 %Title: LAB 2 Part 2 2 %Author: 3 XDate: 4 %Description: This script solves the cosine of pi using the Taylor series %expansion until the result is within a threshold of cos(pi) threshold = 0.0001; %set a threshold to determine when to stop the numerical approximation 8 expansion = 1; %set the initial value of the Taylor series expansion when n=0 9 n - ; %store the number of times through the while loop and the summation index 11 %add your code here 12 13 fprintf("%g iterations to estimate cos(pi) to +/-g ', n, threshold); %print the number of times through the while loop and the estimated cos(pi) Run Script ? Assessment: Submit threshold is properly set cos(pi) used for comparison WHILE loop used no FOR loops used correct Taylor series expansion result for cos(pi) correct number of iterations

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_2

Step: 3

blur-text-image_3

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

Beginning ASP.NET 4.5 Databases

Authors: Sandeep Chanda, Damien Foggon

3rd Edition

1430243805, 978-1430243809

More Books

Students also viewed these Databases questions

Question

2. Compare the sales and service departments at Auto World.

Answered: 1 week ago

Question

What is Change Control and how does it operate?

Answered: 1 week ago

Question

How do Data Requirements relate to Functional Requirements?

Answered: 1 week ago