diff --git a/README.md b/README.md index 13f48c4..822ba54 100644 --- a/README.md +++ b/README.md @@ -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; @@ -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; @@ -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 @@ -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); ``` @@ -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);