Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Use matlab to create a function with structure function P = cosTaylor(x_in,n) where is a vector with evenly spaced entries and n is an even

Use matlab to create a function with structure function P = cosTaylor(x_in,n) where is a vector with evenly spaced entries and n is an even integer. The function should evaluate the degree Taylor polynomial of centered at at each point in the vector and store the results in a vectorP. The Taylor polynomial in question is .image text in transcribed

Create a function with structure function P-CosTaylor(x_in,n) where x is a vector with evenly spaced entries and n is an even integer. The function should evaluate the nth degree Taylor polynomial of cos x centered at x = 0 at each point in the vector Xin and store the results in a vectorP. The Taylor polynomial in question is cos(1)2 (2i)! Your Function C Reset MATLAB Documentation function P = cosTaylor(xin,n) 2 % Input: xin is an array of x-values 3 % Input: n is an even integer to determine degree of Taylor poly 4 % Output: P s a vector of the y-values of the Taylor polynomial corresponding to the 6 P = zeros (1, length(Xin)); 7 8%use loop to add up the terms in the sum 9 for 10 11 end Code to call your function C Reset 1 %As a check, with x linspace(-1,1,5) and n 4, we get 2%P [0.5417 0.8776 1.0000 0.8776 0.5417] 3cosTaylor(linspace (-1,1,5),4)

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

Advances In Databases And Information Systems 22nd European Conference Adbis 2018 Budapest Hungary September 2 5 2018 Proceedings Lncs 11019

Authors: Andras Benczur ,Bernhard Thalheim ,Tomas Horvath

1st Edition

3319983970, 978-3319983974

More Books

Students also viewed these Databases questions

Question

Why do you want to leave your current job?

Answered: 1 week ago

Question

Describe sensitivity analysis Describe sensitivity analysis.

Answered: 1 week ago

Question

explain the concept of strategy formulation

Answered: 1 week ago