Skip to content

yaa16116/curve_fitting

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 

#Problem 1

The function 'least_squares' inputs a matrix Z and a scalar y and outputs best-dit constants, best-fit function as well as the coefficients of determination.

For each one of the proposed cases, the following set of values is obtained:

a) y=0.3745+0.98644x+0.84564/x

a fx r2
0.3745 2.2066 0.9996
0.9864 2.7702
0.8456 3.6157
4.5317
5.4758

b) y=-11.4887+7.143817x-1.04121 x^2+0.046676 x^3

a fx r2
-11.4887 1.8321 0.8290
7.1438 3.4145
-1.0412 4.0347
0.0467 2.9227
2.4947
3.2330
4.9595

c) y=4.0046e^(-1.5x)+2.9213e^(-0.3x)+1.5647e^(-0.05x)

a fx r2
4.0046 5.9321 0.9971
2.9213 4.5461
1.5647 3.2184
2.5789
2.1709
1.8726
1.6425
1.4605
1.1940

#Problem 2 For this problem, we look at the case where the independent variable is temperature and the dependent variable is failure (1=fail, 0=pass). A function called cost_logistic.m takes the vector a, independent variable x and dependent variable y so that the output is [J,grad] or [cost, gradient]. Also, we solved for a0 and a1 on part b and plotted the data in part c.

a) [J, grad] = cost_logistic(a, x, y)

J = 115.5085

grad = 5.0130

b) The result for a0 and a1 generated through cost_logistic

#Problem 3

The function boussinesq_lookup.m is writtent so that when you enter a force , q, dimensions of rectangular area a, b, and depth, z, it uses a third-order polynomial interpolation of the four closest values of m to determine the stress in the vertical direction as shown in the file in the repository.

b) The boussinesq_lookup.m code is copied to a file called boussinesq_spline.m using a cubic spline to interpolate in two dimensions, both m and n, that returns sigma_z.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Languages