Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

MATLAB - HELP IS NEEDED! PLEASE - THE QUESTION HAS ALL THE INFORMATION!!!!! PLEASE POST A CORRECT SOLUTION (a) Write a function called trigseries which

MATLAB - HELP IS NEEDED! PLEASE - THE QUESTION HAS ALL THE INFORMATION!!!!! PLEASE POST A CORRECT SOLUTION

(a) Write a function called trigseries which takes as inputs x (a vector of x-values), n (number of terms in the series), and options (a text string which can be sine, cosine or both). The second two inputs should be optional (with default values n=10, options='both', as appropriate). trigseries should have two outputs: the computed value of the appropriate trigonometric function(s) and the l2 error norm compared with matlab's built-in trigonometric functions (use the command norm).

trigseries should use two subfunctions sine_series and cosine_series which approximate the value of the associated functions at x using the appropriate Taylor series centred around x=0.

(b) Test trigseries using an input x of 10 equally spaced values between 0 and pi/2. Plot the output for both sine and cosine compared with the built-in function values. Test that your function works properly with different numbers of input variables.

(c) Make a log-log plot of the absolute value of the error as a function of the number of terms in the Taylor series for sin(x) for n=1,...,120 terms for x=pi/2 and x=4pi/2. Why does the error eventually become constant? Why do the two values of x give different minimum errors? Explain the difference in terms of the Taylor remainder theorem and loss of floating-point precision by plotting the magnitude nth term in the series for n=1,...,120 terms.

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

Microsoft Office 365 For Beginners 2022 8 In 1

Authors: James Holler

1st Edition

B0B2WRC1RX, 979-8833565759

More Books

Students also viewed these Databases questions

Question

Develop skills for building positive relationships.

Answered: 1 week ago

Question

Describe techniques for resolving conflicts.

Answered: 1 week ago

Question

Give feedback effectively and receive it appropriately.

Answered: 1 week ago