Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
.
  • Loading branch information
mattmaliniak committed Dec 15, 2017
1 parent f766d1d commit b9d8712
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 8 deletions.
3 changes: 3 additions & 0 deletions 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);
4 changes: 4 additions & 0 deletions 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)
8 changes: 7 additions & 1 deletion 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
25 changes: 19 additions & 6 deletions 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)')
ylabel('Pressure (MPa)')
print('Part g','-dpng')
10 changes: 9 additions & 1 deletion 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));
Expand All @@ -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)

0 comments on commit b9d8712

Please sign in to comment.