Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
edited atom
  • Loading branch information
viz12002 committed Nov 17, 2017
1 parent 47bbc63 commit 32cef4f
Showing 1 changed file with 20 additions and 9 deletions.
29 changes: 20 additions & 9 deletions README.md
Expand Up @@ -4,8 +4,7 @@ ME 3255 Homework 5
# Problem 2

##Least Squares Function
``
`
```
function [a,fx,r2] = least_squares_2(Z,y)
%least squares solution for input matrix Z
%and measurements y
Expand All @@ -20,15 +19,12 @@ St=std(y);
Sr=std(e);
r2 = 1-Sr/St;
end
```
```
set defaults

```
## Part A
```
xa=[1 2 3 4 5]';
xa=[1 2 3 4 5]'
ya=[2.2 2.8 3.6 4.5 5.5]';
Z=[ones(size(xa)) xa xa.^-1];
Expand Down Expand Up @@ -143,7 +139,7 @@ Part B
User number 33 was the most precise with a standard deviation of 3.4073
```
# Problem 4

```
Part A
```matlab
Expand All @@ -166,12 +162,15 @@ x2 = std(P_cr)
P_test=1000*9.81/100;
sum(P_cr<P_test)
end
```

```
```matlab
Mean Buckle Load = 164.4154 N
Standard Deviation = 63.6238 N
```
Part B
```
```matlab
function [mean_buckle_load,std_buckle_load]=buckle_monte_carlo_2(E,r_mean,r_std,P_cr);
Expand All @@ -188,12 +187,14 @@ mean(L)
end
```
Output
```
```matlab
L = 5.0108 m
```
#Problem 5

Part A
```
```matlab
function [Cd_out] = sphere_drag(Re_in,spline_type)
data = [2 0.52
Expand All @@ -214,20 +215,25 @@ rho=1.3;V=linspace(4,40);D=23.5e-2;mu=1.78e-5;
Re=rho*V*D/mu*1e-4;
end
```

```
```matlab
Cd_out1 = sphere_drag(150,'linear')
Cd_out2 = sphere_drag(150,'spline')
Cd_out3 = sphere_drag(150,'pchip')
```
Output

```
```matlab
Linear = 0.1400
Spline = 0.1428
Pchip = 0.1447
```

Part B Code
```
```matlab
function [Cd_out] = sphere_drag(Re_in,spline_type)
data = [2 0.52
Expand All @@ -250,6 +256,7 @@ Re=rho*V*D/mu*1e-4;
end
```
Part B Script
```
```matlab
Re=linspace(data(1,1),data(end,1),1000);
rho=1.3;V=linspace(4,40);D=23.5e-2;mu=1.78e-5;
Expand All @@ -270,6 +277,7 @@ saveas(a,'figure_14.png')


Script
```
```matlab
Cd_out1 = sphere_drag(10,'linear')
Cd_out2 = sphere_drag(10,'pchip')
Expand All @@ -284,12 +292,15 @@ legend('data','linear','pchip','spline')
# Problem 6

##Analytical Solution
```
```matlab
fun = @(x) (1/6).*(x).^3+(1/2).*(x).^2+(x);
q = integral(fun,2,3)
```

##Gauss Quadtrature
```
```matlab
%One Point
x = [0];
Expand Down

0 comments on commit 32cef4f

Please sign in to comment.