Skip to content
Permalink
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?
Go to file
 
 
Cannot retrieve contributors at this time
# 05_curve_fitting
## Problem 2
Coefficient of Determination
- Part A: 0.9801
- Part B: 0.9112
- Part C: 0.9462
- Part D: 0.9219
Best Fit Lines
### Part A
- y = 0.375+0.98644x+0.84564/x
![Part A Best Fit Line](./figures/figure1.png)
### Part B
- y = 22.47-1.36x+0.28x^2
![Part B Best Fit Line](./figures/figure2.png)
### Part C
- y = 4.0046e^(-1.5x)+2.9213e^(-0.3x)+1.5647e^(-0.05x)
![Part C Best Fit Line](./figures/figure3.png)
### Part D
- y = 0.99sin(t)+0.5sin(3t)
![Part D Best Fit Line](./figures/figure4.png)
## Problem 3
### Part A
```matlab
darts = dlmread('compiled_data.csv',',',1,0);
x_darts =darts(:,2).*cosd(darts(:,3));
y_darts =darts(:,2).*sind(darts(:,3));
ur = darts(:,1);
i = 1;
for r = 0:32
i_interest = find(ur==r);
mx_ur(i)= mean(x_darts(i_interest));
my_ur(i)= mean(y_darts(i_interest));
i = i +1;
end
accuracy = mx_ur + my_ur;
val = 0; %value trying to be closest to
abs_accuracy = abs(accuracy-val); %takes absolute value of accuracy vector
[~, index] = min(abs_accuracy)
closest_value = accuracy(index)
```
The most accurate dart thrower was person 31, with a combined x and y average of 0.0044 cm away from zero.
### Part B
```matlab
darts = dlmread('compiled_data.csv',',',1,0);
x_darts =darts(:,2).*cosd(darts(:,3));
y_darts =darts(:,2).*sind(darts(:,3));
ur = darts(:,1);
i = 1;
for r = 0:32
i_interest = find(ur==r);
stdx_ur(i)= std(x_darts(i_interest));
stdy_ur(i)= std(y_darts(i_interest));
i = i +1;
end
precision = stdx_ur + stdy_ur;
val = 0; %value trying to be closest to
abs_accuracy = abs(precision-val); %takes absolute value of accuracy vector
[~, index] = min(abs_accuracy)
closest_value = precision(index)
```
The most precise dart thrower was person 32, with a combined x and y standard deviation of 3.407.
## Problem 4
### Part A
```matlab
function [mean_buckle_load,std_buckle_load]=buckle_monte_carlo(E,r_mean,r_std,L_mean,L_std)
r= normrnd(r_mean,r_std,[100 1]);
L= normrnd(L_mean,L_std,[100 1]);
p_cr = (pi.^3.*E.*r.^4)./(16.*L.^2);
mean_buckle_load = mean(p_cr);
std_buckle_load = std(p_cr);
end
```
Output:
- Mean_buckle_load = 160.81 N
- Std_buckle_load = 70.21 N
### Part B
```matlab
N=100;
r_mean=0.01;
r_std=.001;
p_cr = 160.81; %N - from part A
r=normrnd(r_mean,r_std,[N,1]);
L = ((pi^3*E.*r.^4)./(16*p_cr)).^0.5;
L_mean = mean(L)
```
Output:
- Length (L) = 4.955 m
## Problem 5
### Part A
```matlab
cd_out_linear = sphere_drag(300,'linear') = 0.1750
cd_out_spline = sphere_drag(300,'spline') = 0.1809
cd_out_pchip = sphere_drag(300,'pchip') = 0.1807
```
### Part B
![Drag Force vs. Velocity - 3 Interpolation Methods](./figures/figure5.png)
## Problem 6
| Method | Value | Error |
| --- | --- | --- |
| Analytical | 8.375 | 0% |
| 1 Gauss Point | 8.229 | 1.74% |
| 2 Gauss Point | 8.375 | 0% |
| 3 Gauss Point | 8.375 | 0% |