Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Use matlab to finish it Fitting polynomials. (a) Write a script to create a vector x with 100 equally distributed values in the range from

Use matlab to finish it

Fitting polynomials. (a) Write a script to create a vector x with 100 equally distributed values in the range from -5 to 5 . Then calculate y=sin(2x)e^(-sqrt2x) with a perturbation (i.e., a random number in the range -0.5 to 0.5 , by using rand) at each entry of the vector y. Now you have two vectors x and y with 100 entries. (b) Then fit first, second, third, fourth, and fifth order polynomials to these points defined by the vectors x and y. (c) Plot the data (points determined by x and y ) as blue scatter dots (or others, e.g. stars) and a red solid line with a thickness 3 points on a figure, further plot all five polynomial.Label the figure appropriately, including xlabel and ylabel. A suitable title should be given.

Hint: To get good fits, you may have to use the centering and scaling version of polyfit(the one that returns

threearguments, seehelp) and its counter part in polyval(the one that accepts the centering and scaling parameters).

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 Programming With Visual Basic .NET

Authors: Carsten Thomsen

2nd Edition

1590590325, 978-1590590324

More Books

Students also viewed these Databases questions