Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In matlab Obtain a piecewise linear interpolation of the function f(x) = ex/a sin(x2 +b) where a is the rst digit of your SUID and

In matlab

Obtain a piecewise linear interpolation of the function f(x) = ex/a sin(x2 +b) where a is the rst digit of your SUID and b is its last digit. Interpolation should take place on the interval [0,7]. Try equally spaced nodes with distance h = 1, h = 0.5, until you nd one that works reasonably well. Report the spacing h you found suitable in a comment.

Method: To begin with, dene a function f (function handle would work). Calculate the nodes, the values of f at nodes, and the slopes of interpolating segments (the vector slope below; you may refer to the function pwL). Then evaluate the interpolant.

One approach is this: t = linspace (0 ,7 ,100);

pl = zeros ( size ( t ));

for i = 1: length ( t ) i f t ( i ) == x(1) pl ( i ) = y(1) + slope (1) ( t ( i ) x(1) );

else id = sum(x

pl ( i ) = y( id ) + slope ( id ) ( t ( i ) x( id ) );

end end Finally, plot both f and the interpolant together for comparison, using dierent colors.

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

Flash XML Applications Use AS2 And AS3 To Create Photo Galleries Menus And Databases

Authors: Joachim Schnier

1st Edition

0240809173, 978-0240809175

More Books

Students also viewed these Databases questions

Question

How are members held accountable for serving in the assigned roles?

Answered: 1 week ago