Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Problem 4 and 6
  • Loading branch information
ayr13001 committed Nov 17, 2017
1 parent 003b80e commit b726714
Showing 1 changed file with 97 additions and 0 deletions.
97 changes: 97 additions & 0 deletions README.md
Expand Up @@ -111,3 +111,100 @@ end
```
Most precise dart thrower: User 32
- combined x & y STD of 3.4073

#Problem 4
###Part A
```matlab
function [mean_buckle_load,std_buckle_load]=buckle_monte_carlo(E,r_mean,r_std,L_mean,L_std);
N=100;
r_mean=0.01;
r_std=.001;
L_mean=5;
L_std=L_mean*0.01;
rrand=normrnd(r_mean,r_std,[N,1]);
Lrand=normrnd(L_mean,L_std,[N,1]);
E = 200*10^9;
P_cr=(pi^3*E.*rrand.^4)./(16.*Lrand.^2);
x1 = mean(P_cr)
x2 = std(P_cr)
P_test=1000*9.81/100;
sum(P_cr<P_test)
end
```
Output:
- Mean_buckle_load = 164.4154 N
- STD = 63.6238 N

###Part B
```matlab
function [mean_buckle_load,std_buckle_load]=buckle_monte_carlo_2(E,r_mean,r_std,P_cr);
N=100;
r_mean=0.01;
r_std=.001;
P_test=1000*9.81/100;
sum(2.5<P_test)
P_cr = 164.4154;
rrand=normrnd(r_mean,r_std,[N,1]);
E = 200*10^9;
L = ((pi^3*E.*rrand.^4)./(16*P_cr)).^0.5;
mean(L)
end
```
Output:
- L = 5.0108 m
#Problem 5
###Part A

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

###Gauss Quadrature
###1-point
```matlab
x = [0];
c = [2];
a = 2;
b = 3;
tildec = (b-a)/2*c;
tildex = (b-a)/2*x + (b+a)/2;
f = (1/6).*(tildex).^3+(1/2).*(tildex).^2+(tildex);
value1 = sum(tildec.*f)
```
###2-point
```matlab
x = [-0.57735,0.57735];
c = [1,1];
a = 2;
b = 3;
tildec = (b-a)/2*c;
tildex = (b-a)/2*x + (b+a)/2;
f = (1/6).*(tildex).^3+(1/2).*(tildex).^2+(tildex);
value2 = sum(tildec.*f)
```
###3-point
```matlab
%Three Point
x = [-0.77459666,0,0.77459666];
c = [0.5555555,0.88888888,0.55555555];
a = 2;
b = 3;
tildec = (b-a)/2*c;
tildex = (b-a)/2*x + (b+a)/2;
f = (1/6).*(tildex).^3+(1/2).*(tildex).^2+(tildex);
value3 = sum(tildec.*f)
```

| Method | Value | Error |
| Analytical | 8.3750 | 0% |
| 1 Gauss Point | 8.2292 | 1.74% |
| 2 Gauss Point | 8.3750 | 0% |
| 3 Gauss Point | 8.3750 | 0% |

0 comments on commit b726714

Please sign in to comment.