Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
1
  • Loading branch information
Leahy committed Dec 14, 2017
1 parent 05281d1 commit 66a5d7d
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 8 deletions.
12 changes: 8 additions & 4 deletions README.md
Expand Up @@ -2,7 +2,7 @@

## Part A
### Problem Statement
Create a function that uses the central finite difference approximation to solve for the displacements of a membrane with 3 x 3 interior nodes. The function should take the pressure and tension as inputs and output a column vector, w.
Create a function called membrane_solution3 that uses the central finite difference approximation to solve for the displacements of a membrane with 3 x 3 interior nodes. The function should take the pressure (P) and tension (T) as inputs and output a column vector, w.

``` matlab
function [w] = membrane_solution3(T,P) % Set up initial matrix
Expand All @@ -26,15 +26,18 @@ end

## Part B
### Problem Statement
Using the function from part A as well as a given tension of 0.006 and a given pressure of 0.001, solve for w and plot the result in 3 dimensions
Using the function from part A as well as a given tension of 0.006 uN/um and a given pressure of 0.001 MPa, solve for w and plot the result in 3 dimensions

``` matlab
[w] = membrane_solution3(0.006,0.001);
```

![3x3 Interior Nodes](./figures/figure1.png)

### Part C
## Part C
### Problem Statement
Create a function called membrane_solution that uses the central finite difference approximation to solve for the displacements of a membrane with n x n interior nodes. The function should take the pressure (P), tension (T), and number of interior nodes (n) as inputs and output the column vector, w.

```matlab
function [w] = membrane_solution(T,P,n)% Set up initial matrix
% T = given tension (microNewton/micrometer)
Expand All @@ -56,7 +59,8 @@ function [w] = membrane_solution(T,P,n)% Set up initial matrix
end
```

### Part D
## Part D
### Problem Statement
``` matlab
[w] = membrane_solution(0.006,0.001,10)
```
Expand Down
23 changes: 19 additions & 4 deletions SE_diff.m
Expand Up @@ -8,21 +8,36 @@ function [pw_se,w] = SE_diff(T,P,n)
m(2:n+1,2:n+1) = c; % insert matrix c into middle of m matrix
% m = symmetric matrix

h = 10/(n+1); % h = delta_x = delta_y (micron)
h = 10/(n+1); % h = delta_x = delta_y (micron)

% Compute w bar
w_bar = zeros(n+1,n+1);
for i = 1:n+1
for j = 1:n+1
w_bar(i,j) = (m(i,j)+m(i,j+1)+m(i+1,j)+m(i+1,j+1))/4;
end
end

% Left side of the equation
left_side = zeros(n+1,n+1);
for i = 1:n+1

left_side(i) = P * h^2*w_bar(i);
end

% Compute dw_dx
dx = zeros(n+2,n+1);
for i = 2:n+2
dx(:,i-1)= (m(:,i)-m(:,i-1))/(h);
end

dw_dx = zeros(n+1,n+1);
for i = 1:n+1 % rows
for j = 1:n+1 % columns
dw_dx(i,j) = (dx(i,j)+dx(i+1,j))/2;
end
end
disp(dw_dx)
% Compute dw_dy
dy = zeros(n+1,n+2);
for i = 2:n+2
Expand All @@ -35,7 +50,7 @@ function [pw_se,w] = SE_diff(T,P,n)
dw_dy(i,j) = (dy(i,j)+dy(i,j+1))/2;
end
end
disp(dw_dy)
pw_se = zeros(n+1,n+1);

for i = 1:(n+1)^2
Expand Down

0 comments on commit 66a5d7d

Please sign in to comment.