0% found this document useful (0 votes)
10 views5 pages

Lec 16

The document discusses curve fitting in MATLAB, emphasizing the process of finding a function that models data with minimal error, also known as regression analysis. It provides several examples using the least squares method for fitting linear and quadratic functions to given data sets, along with the resulting equations and specific evaluations. The examples illustrate how to apply the method to different data points and the outcomes for specified values.

Uploaded by

BaTaEl- BR
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views5 pages

Lec 16

The document discusses curve fitting in MATLAB, emphasizing the process of finding a function that models data with minimal error, also known as regression analysis. It provides several examples using the least squares method for fitting linear and quadratic functions to given data sets, along with the resulting equations and specific evaluations. The examples illustrate how to apply the method to different data points and the outcomes for specified values.

Uploaded by

BaTaEl- BR
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Curve Fitting in MATLAB:

Curve fitting is a process of finding a function that can be used to model


data. The function does not necessarily pass through any of the points, but
models the data with the smallest possible error. Curve fitting is also called
regression analysis (Method of least square).
Example 1: Use least square method for fitting and finding y=f(x) for
following data:
xi=[0 1 3 4]
yi=[1 3 7 10]

Note: Fit with linear method.


Example 2: Use least square method for fitting and finding y=f(x) for
following data:
x=[-1.3 -0.1 0.2 1.3]
y=[0.103 1.099 0.808 1.897]

Note: Fit straight line.

Equation: 𝑦 = 0.66702𝑥 + 0.96007


Example 3: Use least square method for fitting and finding y=f(x) for following
data:
x=[0 2 4 6 8]
y=[5 4 1 6 7]

Note: Use Quadratic method.

Equation: 𝑦 = 0.2143𝑥 2 − 1.4143𝑥 + 5.1143


Example 4: Use least square method for fitting and finding y=f(x) for following
data:
x=[-1 0 1 2]
y=[3 0 2 8]
Find f(x) for x= 5.3
Find f(x) for x= -1:0.01:1

Note: Use Quadratic method.

Equation: 𝑦 = 2.25𝑥 2 − 0.55𝑥 + 0.15

For x=5.3 → 𝑓(𝑥) = 60.4

For x= -1:0.01:1 → 𝑓 𝑥 = 2.95, 2.90, 2.85, 2.80, ….

You might also like