Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Part C update
- Loading branch information
Showing
2 changed files
with
42 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |