diff --git a/Part B/PartB.m b/Part B/PartB.m index 385af97..28ea72d 100644 --- a/Part B/PartB.m +++ b/Part B/PartB.m @@ -1,2 +1,5 @@ % Part B Script +% From problem statement: +% T=0.006 uN/um +% P=0.001 MPa [w] = membrane_solution3(0.006,0.001); \ No newline at end of file diff --git a/Part D/PartD.m b/Part D/PartD.m index 8cdb9c2..b7ee4a7 100644 --- a/Part D/PartD.m +++ b/Part D/PartD.m @@ -1,2 +1,6 @@ % Part D Script +% From problem statement: +% T=0.006 uN/um +% P=0.001 MPa +% n = 10 nodes [w] = membrane_solution(0.006,0.001,10) \ No newline at end of file diff --git a/Part F/F_sol.m b/Part F/F_sol.m index 1a749ca..5acc160 100644 --- a/Part F/F_sol.m +++ b/Part F/F_sol.m @@ -1,7 +1,13 @@ +% Part F script +% From Problem Statement: n=[3,20:5:40]; P=0.001; %MPa + + % Sets vector length so it doesn't change every iteration in for loop T = zeros(1,length(n)); ea = zeros(1,length(n)); + + % Uses tension_sol function to solve for the tension for each input for i = 1:length(n) - [T(i), ea(i)] = tension_sol(P,n(i)); +[T(i), ea(i)] = tension_sol(P,n(i)); end \ No newline at end of file diff --git a/Part G/part_g.m b/Part G/part_g.m index 6505df9..048de5f 100644 --- a/Part G/part_g.m +++ b/Part G/part_g.m @@ -1,20 +1,33 @@ +% Part G Script +% From Problem Statement P = linspace(.001,.01,10); n = 20; + +% Sets vector length so it doesn't change every iteration in for loop T = zeros(1,length(P)); wmax = zeros(1,length(P)); + +% Uses tension_sol and membrane_solution functions to solve for the maximum displacement for all iterations for i = 1:length(P) T(i) = tension_sol(P(i),n); w = membrane_solution(T(i),P(i),n); wmax(i) = max(w); end + +% Sets up figure for plot clf setDefaults + +% Standard Linear Regression with equation P(x) = A*w^2 x = wmax'; y = P'; -Z = x.^3; -a = Z\y; -x_fcn = linspace(min(x),max(x)); -plot(x,y,'o',x_fcn,a.*x_fcn.^3) -title('Pressure vs. Maximum Deflection') +Z=x.^3; +a=Z\y; +x_fcn=linspace(min(x),max(x)); + +% Plots regression line with actual points +plot(x,y,'o',x_fcn,a*x_fcn.^3) +title('Pressure vs Maximum Deflection') xlabel('Maximum Deflection (um)') -ylabel('Pressure (MPa)') \ No newline at end of file +ylabel('Pressure (MPa)') +print('Part g','-dpng') \ No newline at end of file diff --git a/Part H/part_h.m b/Part H/part_h.m index 30fa740..ed80310 100644 --- a/Part H/part_h.m +++ b/Part H/part_h.m @@ -1,6 +1,12 @@ +% Part G Script +% From Problem Statement P=0.001; -n = 5:5:45; +n = 5:5:50; + +% Sets vector length so it doesn't change every iteration in for loop a = zeros(1,length(n)); + +% Uses tension_sol and membrane_solution functions along with a regression line to solve for the constant A in the regression line for i = 1:length(n) T = tension_sol(P,n(i)); w = membrane_solution(T,P,n(i)); @@ -10,4 +16,6 @@ for i = 1:length(n) Z = x.^3; a(i) = Z\y; end + +% Calculates the relative error between the constant A values Rel_error(a) \ No newline at end of file