Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Part C update
  • Loading branch information
ayr13001 committed Dec 15, 2017
1 parent ed83626 commit a4b43a8
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 20 deletions.
44 changes: 33 additions & 11 deletions README.md
Expand Up @@ -43,7 +43,6 @@ Solve for w given a pressure, P=0.001 MPa and tension, T=0.006 uN/um. Plot the r
`surf(X,Y,W)` where X, Y, and W are the x-, y-, and z-coordinates of each point on the
membrane from 0-10um.
#### Approach

T = 0.006 uN/um
P = 0.001 MPa
```matlab
Expand All @@ -56,23 +55,46 @@ P = 0.001 MPa
#### Problem Statement
Create a general central finite difference approximation of the gradient with
n-by-n interior nodes of w
for the given membrane solution in terms of P and T. `[w]=membrane_solution(T,P,n);` The
output `w` should be a vector, but the solution represents a 2D data set w(x,y).
#### Approach
for the given membrane solution in terms of P and T. `[w]=membrane_solution(T,P,n);`

General central finite difference approximation for gradient
of nxn interior nodes of w.
#### Approach
```matlab
[w] = membrane_solution(T,P,n)
function [w] = membrane_solution(T,P,n)
% General Central finite difference approximation of
% gradient with n-by-n interior nodes in terms of P & T.
% Input:
% T = tension per unit length (uN/um)
% P = pressure (MPa)
% n = # of interior node rows/columns
% Output:
% w = displacement vector for 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;
% Find displacement vector w
% which represents 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]);
% Plot gradient of membrane displacement
surf(x,y,z)
title('Gradient of Membrane Displacement')
zlabel('Displacement [um] (micrometers)')
end
```

## Part D
#### Problem Statement
Solve for w given a pressure, P=0.001 MPa and tension, T=0.006 uN/um with 10 interior
nodes. Plot the result with `surf(X,Y,W)` where X, Y, and W are the x-, y-, and
z-coordinates of each point on the membrane from 0-10um.
#### Approach
Solve for w given a pressure, P=0.001 MPa and tension, T=0.006 uN/um with 10 interior nodes. Plot the result with `surf(X,Y,W)` where X, Y, and W are the x-, y-, and z-coordinates of each point on the membrane from 0-10um.

#### Approach
- T = 0.006 uN/um
- P = 0.001 MPa
- n = 10 nodes
Expand Down
18 changes: 9 additions & 9 deletions membrane_solution.m
@@ -1,28 +1,28 @@
function [w] = membrane_solution(T,P,n)
%
% General Central finite difference approximation of
% gradient with n-by-n interior nodes in terms of P & T.
% Input:
% T = tension per unit length (uN/um)
% P = pressure (MPa)
% n = # of interior nodes
% n = # of interior node rows/columns
% Output:
% w = displacement vector for 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;

%
% Find displacement vector w
% which represents 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]);

% Plot gradient of membrane displacement
surf(x,y,z)

title('Gradient of Membrane Displacement')
zlabel('Displacement [um] (micrometers)')
end

0 comments on commit a4b43a8

Please sign in to comment.