Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

% Newton's Polynomial solver X=sort(rand([10,1])*2*pi); Y=sin(X); %(X,Y) are the points to interpolate. x=linspace(0,2*pi,200); a=polyNewton(X,Y); y=arrayfun(@(x) interpNewton(a,X,x), x); function a=polyNewton(X,Y) a=zeros(size(Y)); end function y=interpNewton(a,X,x) end Question

image text in transcribed

% Newton's Polynomial solver

X=sort(rand([10,1])*2*pi);

Y=sin(X);

%(X,Y) are the points to interpolate.

x=linspace(0,2*pi,200);

a=polyNewton(X,Y);

y=arrayfun(@(x) interpNewton(a,X,x), x);

function a=polyNewton(X,Y)

a=zeros(size(Y));

end

function y=interpNewton(a,X,x)

end

Question 1. For this test, you need to write two functions: polyNewton (X,Y) and interpNewton (a,X,X). X and Y are vectors which contains the values to be interpolated. polyNewton (X, Y ) returns a vector with the coefficients of the Newton's polynomial. interpNewton (a,X,x) uses the output of polyNewton and X to calculate the interpolated values at points contained in x. The twist is that you are allowed one and only ONE for-loop in each function AND you are not allowed to allocate any extra memory aside from a, which stores the output in polyNewton, and y which stores the output in interpNewton (the dummy

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

Database Processing Fundamentals, Design, and Implementation

Authors: David M. Kroenke, David J. Auer

14th edition

133876705, 9781292107639, 1292107634, 978-0133876703

More Books

Students also viewed these Databases questions

Question

Question What is the advantage of a voluntary DBO plan?

Answered: 1 week ago

Question

Question How is life insurance used in a DBO plan?

Answered: 1 week ago