diff --git a/Part A/membrane_solution3.m b/Part A/membrane_solution3.m index d62636f..bbd0c09 100644 --- a/Part A/membrane_solution3.m +++ b/Part A/membrane_solution3.m @@ -19,13 +19,18 @@ w = k\y; % Solves for displacement (micrometers) % Solution represents a 2D data set w(x,y) -[x,y] = meshgrid(0:10/4:10,0:10/4:10); -z = zeros(size(x)); -z(2:end-1,2:end-1) = reshape(w,[3 3]); -surf(x,y,z) -title('Membrane Displacement') -zlabel('Displacement (micrometer)') + + [x,y] = meshgrid(0:10/4:10,0:10/4:10); + z = zeros(size(x)); + z(2:end-1,2:end-1) = reshape(w,[3 3]); + surf(x,y,z) + title('Membrane Displacement (3 x 3)') + zlabel('Z Position (micron)') + ylabel('Y Position (micron)') + xlabel('X Position (micron)') + % Membrane displacement is shown on chart % Membrane displacement is shown on chart -end \ No newline at end of file +end + diff --git a/Part B/PartBFigure.png b/Part B/PartBFigure.png index 4699760..32dd6f3 100644 Binary files a/Part B/PartBFigure.png and b/Part B/PartBFigure.png differ diff --git a/Part B/membrane_solution3.m b/Part B/membrane_solution3.m new file mode 100644 index 0000000..d495083 --- /dev/null +++ b/Part B/membrane_solution3.m @@ -0,0 +1,25 @@ +function [w] = membrane_solution3(T,P) + % T = Tension (microNewton/micrometer) + % P = Pressure (MPa) + + od = ones(8,1); + od(3:3:end) = 0; + k = -4*diag(ones(9,1))+diag(ones(9-3,1),3)+diag(ones(9-3,1),-3)+diag(od,1)+diag(od,-1); + + + y = -(10/4)^2*(P/T)*ones(9,1); + w = k\y; + % Solves for displacement (micrometers) + % Solution represents a 2D data set w(x,y) + + [x,y] = meshgrid(0:10/4:10,0:10/4:10); + z = zeros(size(x)); + z(2:end-1,2:end-1) = reshape(w,[3 3]); + surf(x,y,z) + title('Membrane Displacement (3 x 3)') + zlabel('Z Position (micron)') + ylabel('Y Position (micron)') + xlabel('X Position (micron)') + % Membrane displacement is shown on chart + +end \ No newline at end of file diff --git a/Part C/membrane_solution.m b/Part C/membrane_solution.m index a3b6d3e..656f95e 100644 --- a/Part C/membrane_solution.m +++ b/Part C/membrane_solution.m @@ -22,7 +22,9 @@ w = k\y; z = zeros(size(x)); z(2:end-1,2:end-1) = reshape(w,[n n]); surf(x,y,z) -title('Membrane Displacement') -zlabel('Displacement (micrometer)') +title('Membrane Displacement (10 x 10)') +zlabel('Z Position (micron)') +ylabel('Y Position (micron)') +xlabel('X Position (micron)') % Membrane displacement is shown on chart -end \ No newline at end of file +end diff --git a/Part D/PartDFigure.png b/Part D/PartDFigure.png index ca69c45..f367cda 100644 Binary files a/Part D/PartDFigure.png and b/Part D/PartDFigure.png differ diff --git a/Part D/membrane_solution.m b/Part D/membrane_solution.m new file mode 100644 index 0000000..f5a442a --- /dev/null +++ b/Part D/membrane_solution.m @@ -0,0 +1,25 @@ +function [w] = membrane_solution(T,P,n) + % T = Tension (microNewton/micrometer) + % P = Pressure (MPa) + % n = # of interior nodes + + od = ones(n^2-1,1); + od(n:n:end) = 0; + k = -4*diag(ones(n^2,1))+diag(ones((n^2)-n,1),n)+diag(ones((n^2)-n,1),-n)+diag(od,1)+diag(od,-1); + + y = -(10/(n+1))^2*(P/T)*ones(n^2,1); + w = k\y; + % Solves for displacement (micrometers) + % Output w is a vector + % Solution represents a 2D data set w(x,y) + + [x,y] = meshgrid(0:10/(n+1):10,0:10/(n+1):10); + z = zeros(size(x)); + z(2:end-1,2:end-1) = reshape(w,[n n]); + surf(x,y,z) + title('Membrane Displacement (10 x 10)') + zlabel('Z Position (micron)') + ylabel('Y Position (micron)') + xlabel('X Position (micron)') + % Membrane displacement is shown on chart +end \ No newline at end of file diff --git a/README.md b/README.md index 13f48c4..1bd4f88 100644 --- a/README.md +++ b/README.md @@ -3,31 +3,46 @@ # Part A ```matlab function [w] = membrane_solution3(T,P) - % T = Tension (microNewton/micrometer) - % P = Pressure (MPa) - - od = ones(8,1); - od(3:3:end) = 0; - k = -4*diag(ones(9,1))+diag(ones(9-3,1),3)+diag(ones(9-3,1),-3)+diag(od,1)+diag(od,-1); - - - y = -(10/4)^2*(P/T)*ones(9,1); - w = k\y; - % Solves for displacement (micrometers) - % Output w is a vector - % Solution represents a 2D data set w(x,y) +% 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; +k = -4*diag(ones(9,1))+diag(ones(9-3,1),3)+diag(ones(9-3,1),-3)+diag(od,1)+diag(od,-1); + + +y = -(10/4)^2*(P/T)*ones(9,1); +w = k\y; + +% Solves for displacement (micrometers) +% Solution represents a 2D data set w(x,y) + [x,y] = meshgrid(0:10/4:10,0:10/4:10); z = zeros(size(x)); z(2:end-1,2:end-1) = reshape(w,[3 3]); surf(x,y,z) - title('Membrane Displacement') - zlabel('Displacement (micrometer)') - % Membrane displacement is shown on chart - -end -``` + title('Membrane Displacement (3 x 3)') + zlabel('Z Position (micron)') + ylabel('Y Position (micron)') + xlabel('X Position (micron)') +% Membrane displacement is shown on chart + +end + +``` +### Approach +- A matrix is set up using finite element analysis of the interior nodes of a 5x5 matrix +- A vector for the y direction is then set up for the membrane +- Using linear algebra, a vector for the displacement of the nodes is created +- The vector can then be transformed to represent the actual surface as a matrix # Part B ```matlab @@ -40,9 +55,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; @@ -58,12 +78,16 @@ function [w] = membrane_solution(T,P,n) z = zeros(size(x)); z(2:end-1,2:end-1) = reshape(w,[n n]); surf(x,y,z) - title('Membrane Displacement') - zlabel('Displacement (micrometer)') + title('Membrane Displacement (10 x 10)') + zlabel('Z Position (micron)') + ylabel('Y Position (micron)') + xlabel('X Position (micron)') % Membrane displacement is shown on chart end ``` - +### Approach +- This problem uses the same steps as with the membrane_solution3 function, except it allows for the user to change the number of interior nodes +- This required alterations of the all the indexing and sizing in the function along with a few calculations # Part D ```matlab @@ -76,6 +100,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 @@ -102,6 +138,12 @@ end se = E*t*h^2/(2*(1-v^2))*sum(sum(0.25.*dwdx.^4+.25.*dwdy.^4+0.5.*(dwdx.*dwdy).^2)); pw_se = pw-se; ``` +### Approach +- Using the membrane_solution function, a vector of the displacements is formed +- Next, the average displacement for each element is calculated. For each elements, the dispalcement at all four courners is taken and then averaged +- Using these values, the work done by pressure can be calculated +- For the change in dispalcement over the x and y coordinate system, the values of the change on the left and right (y-axis) or top and bottom (x-axis) are taken and averaged +- Using these values, the strain energy can be calculated # Part F ```matlab @@ -115,7 +157,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 +212,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); @@ -174,7 +233,9 @@ end |35|0.0602|0.09%| |40|0.0603|0.06%| - +### Approach +- This problem uses the bisect method for locating roots and the SE_diff function for calculating the difference in work and strain energy of the membrane +- The script runs through all iterations of different amounts of nodes, zeroing the SE_diff function output and saving the values for tension in the T variable as a vector # Part G ```matlab P = linspace(.001,.01,10); @@ -200,3 +261,9 @@ ylabel('Pressure (MPa)') print('Part g','-dpng') ``` ![](https://github.uconn.edu/ltd13002/ME3255_Final_Project/blob/master/Part%20G/Part%20g.png) + +### Approach +- This script uses the tension_sol function as described in the part above, running though all iterations of pressure +- Additionally, the max deflection for each pressure and tension is calculated at each iteration +- From there, a general linear regression is calculated with the formula P(x) = A*w^3 +- The results are plotted