Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

MATLAB - PLS HELP 1. (a) Write a function called trigseries which takes as inputs x (a vector of x-values), n (number of terms in

MATLAB - PLS HELP

image text in transcribed

1. (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 ap- proximate 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 7/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 = n/2 and 3 = 46/2. Why does the error eventually become constant? Why do the two values of I give different minimum errors? Explain the difference in terms 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

Oracle 11G SQL

Authors: Joan Casteel

2nd Edition

1133947360, 978-1133947363

More Books

Students also viewed these Databases questions

Question

Why are bankers concerned about money laundering?

Answered: 1 week ago

Question

=+ How well do you think you could do your job?

Answered: 1 week ago