   # Explain how you would fit a curve to a set of data in MATLAB. ### Engineering Fundamentals: An Intro...

5th Edition
Saeed Moaveni
Publisher: Cengage Learning
ISBN: 9781305084766

#### Solutions

Chapter
Section ### Engineering Fundamentals: An Intro...

5th Edition
Saeed Moaveni
Publisher: Cengage Learning
ISBN: 9781305084766
Chapter 15.5, Problem 4BYG
Textbook Problem
8 views

## Explain how you would fit a curve to a set of data in MATLAB.

To determine

Explain the steps that how you would fit a curve to a set of data in MATLAB.

### Explanation of Solution

The MATLAB offers a curve fitting to obtain an equation that fits the set of data. Using the command “polyfit(x,y,n)” the coefficients of the equation (C0,C1,C2........Cn) can be found which sets the equation as mentioned below:

y=C0xn+C1xn1+C2xn2+.......Cn (1)

Here,

xandy are the given data points,

n is the number of coefficients.

Example :

Find the equation that best fits the following data points and compare the actual and predicted y values.

Consider the data points as follows,

 x 0 1 2 3 4 5 6 7 8 9 10 y 10 12 15 19 23 25 27 32 34 36 41

The steps to find the equation that fits the following data points using MATLAB are as follows:

• Draw the plot for the given data points using “plot” command.
• Using the curve fitting method to find the best fit equation using the command “coefficients=polyfit(x,y,n)”. Here ‘n’ is the order of the poly-fit equation.
• The value of y predicted is calculated using the quadratic equation ypredicted=C0+C1x+C2x2, where C0 , C1  and C2 are the poly-fit equation coefficients

### Still sussing out bartleby?

Check out a sample textbook solution.

See a sample solution

#### The Solution to Your Study Problems

Bartleby provides explanations to thousands of textbook problems written by our experts, many with advanced degrees!

Get Started

Find more solutions based on key concepts
Describe data and process modeling concepts and tools.

Systems Analysis and Design (Shelly Cashman Series) (MindTap Course List)

Determine the tension TB in Sample Problem 5.6 using one scalar equilibrium equation.

International Edition---engineering Mechanics: Statics, 4th Edition

What factors negatively affect latency? (476)

Enhanced Discovering Computers 2017 (Shelly Cashman Series) (MindTap Course List)

Why might you want to install two power supplies in a critical server?

Network+ Guide to Networks (MindTap Course List)

What is the purpose of grooving a joint before welding on thick plate?

Welding: Principles and Applications (MindTap Course List)

If your motherboard supports ECC DDR3 memory, can you substitute non-ECC DDR3 memory?

A+ Guide to Hardware (Standalone Book) (MindTap Course List) 