Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Update README.md
  • Loading branch information
mam13081 committed Dec 15, 2017
1 parent f9e32f6 commit be65846
Showing 1 changed file with 46 additions and 6 deletions.
52 changes: 46 additions & 6 deletions README.md
Expand Up @@ -3,8 +3,14 @@
# Part A
```matlab
function [w] = membrane_solution3(T,P)
% T = Tension (microNewton/micrometer)
% P = Pressure (MPa)
% membrane_solution3: dispalacement of node for membrane with 3x3 interior
% nodes
% [w] = membrane_solution3(T,P)
% input:
% T = Tension (microNewton/micrometer)
% P = Pressure (MPa)
% output:
% w = vector of displacement of interior nodes
od = ones(8,1);
od(3:3:end) = 0;
Expand Down Expand Up @@ -40,9 +46,14 @@ end
# Part C
```matlab
function [w] = membrane_solution(T,P,n)
% T = Tension (microNewton/micrometer)
% P = Pressure (MPa)
% n = # of interior nodes
% membrane_solution: dispalacement of node for membrane with nxn interior nodes
% [w] = membrane_solution(T,P,n)
% input:
% T = Tension (microNewton/micrometer)
% P = Pressure (MPa)
% n = number of rows and columns of interior nodes
% output:
% w = vector of displacement of interior nodes
od = ones(n^2-1,1);
od(n:n:end) = 0;
Expand Down Expand Up @@ -76,6 +87,18 @@ end
# Part E
```matlab
function [pw_se,w]=SE_diff(T,P,n)
% SE_diff: calculates difference between strain energy and work done by pressure in
% membrane
% [pw_se,w]=SE_diff(T,P,n)
% input:
% T = Tension (microNewton/micrometer)
% P = Pressure (MPa)
% n = number of rows and columns of interior nodes
% output:
% pw_se = difference between strain energy and work done by pressure in
% membrane
% w = vector of displacement of interior nodes
E = 1; %TPa Units may need to be changed
v = .31; %Poissons ratio
t = .3; %nm
Expand Down Expand Up @@ -115,7 +138,17 @@ pw_se = pw-se;
end
```
```matlab
function [T,ea] = tension_sol(P,n)
function [T,ea] = tension_sol(P,n)
% tension_sol: outputs tension of a membrane given the pressure and number
% of nodes
% [T,ea] = tension_sol(P,n)
% input:
% P = Pressure (MPa)
% n = number of rows and columns of interior nodes
% output:
% T = Tension (microNewton/micrometer)
% ea = approximate relative error (%)
y =@(T) SE_diff(T,P,n);
[T,fx,ea,iter]=bisect(y,.01,1);
```
Expand Down Expand Up @@ -160,6 +193,13 @@ root = xr; fx = func(xr, varargin{:});
```
```matlab
function re = Rel_error (T)
Rel_error: calculates relative error of a vector
% re = Rel_error (T)
% input:
% T = vector of numbers
% output:
% re = relative error of vector
re = zeros(1,length(T)-1);
for i = 2:length(T)
re(i-1)= abs(T(i)-T(i-1))/T(i-1);
Expand Down

0 comments on commit be65846

Please sign in to comment.