Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
part C and D done
  • Loading branch information
nin13001 committed Dec 15, 2017
1 parent 3331f14 commit 1c8de35
Show file tree
Hide file tree
Showing 6 changed files with 87 additions and 4 deletions.
41 changes: 39 additions & 2 deletions README.md
Expand Up @@ -8,11 +8,11 @@ function [w] = membrane_solution3(T,P)
od = ones(8,1);
od(3:3:end) = 0;
k = -4*diag(ones(9,1))+diag(ones(9-3,1),3)+diag(ones(9-3,1),-3)+diag(od,1)+diag(od,-1);
a = -4*diag(ones(9,1))+diag(ones(9-3,1),3)+diag(ones(9-3,1),-3)+diag(od,1)+diag(od,-1);
y = -(10/4)^2*(P/T)*ones(9,1);
w = k\y;
w = a\y;
grid on
[x,y] = meshgrid(0:10/4:10,0:10/4:10);
Expand All @@ -36,3 +36,40 @@ end
membrane_solution3(0.006,0.001)
```
![](assets/README-20ed9cd0.png)

## Part C

```
function [w] = membrane_solution3(T,P)
od = ones(8,1);
od(3:3:end) = 0;
a = -4*diag(ones(9,1))+diag(ones(9-3,1),3)+diag(ones(9-3,1),-3)+diag(od,1)+diag(od,-1);
y = -(10/4)^2*(P/T)*ones(9,1);
w = a\y;
grid on
[x,y] = meshgrid(0:10/4:10,0:10/4:10);
z = zeros(size(x));
z(2:end-1,2:end-1) = reshape(w,[3 3]);
surf(x,y,z)
title('Membrane Displacement')
xlabel('X (\muM)')
ylabel('Y (\muM)')
zlabel('Displacement (\muM)')
colormap jet
shading interp
disp(w)
end
```

## Part D

```
membrane_solution(0.006,0.001,10)
```
![](assets/README-579fb915.png)
Binary file added assets/PartD.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/README-579fb915.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions membrane_solution.m
@@ -0,0 +1,21 @@
function [w] = membrane_solution(T,P,n)

od = ones(n^2-1,1);
od(n:n:end) = 0;
a = -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 = a\y;
grid on
[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]);
surf(x,y,z)
title('Membrane Displacement')
xlabel('X (\muM)')
ylabel('Y (\muM)')
zlabel('Displacement (\muM)')
colormap jet
shading interp
disp(w)
end
25 changes: 25 additions & 0 deletions membrane_solution3.asv
@@ -0,0 +1,25 @@
function [w] = membrane_solution3(T,P)


od = ones(8,1);
od(3:3:end) = 0;
a = -4*diag(ones(9,1))+diag(ones(9-3,1),3)+diag(ones(9-3,1),-3)+diag(od,1)+diag(od,-1);


y = -(10/4)^2*(P/T)*ones(9,1);
w = a\y;

grid on
[x,y] = meshgrid(0:10/4:10,0:10/4:10);
z = zeros(size(x));
z(2:end-1,2:end-1) = reshape(w,[3 3]);
surf(x,y,z)
title('Membrane Displacement')
xlabel('X (\muM)')
ylabel('Y (\muM)')
zlabel('Displacement (\muM)')
colormap jet
shading interp
disp(w)

end
4 changes: 2 additions & 2 deletions membrane_solution3.m
Expand Up @@ -3,11 +3,11 @@ function [w] = membrane_solution3(T,P)

od = ones(8,1);
od(3:3:end) = 0;
k = -4*diag(ones(9,1))+diag(ones(9-3,1),3)+diag(ones(9-3,1),-3)+diag(od,1)+diag(od,-1);
a = -4*diag(ones(9,1))+diag(ones(9-3,1),3)+diag(ones(9-3,1),-3)+diag(od,1)+diag(od,-1);


y = -(10/4)^2*(P/T)*ones(9,1);
w = k\y;
w = a\y;

grid on
[x,y] = meshgrid(0:10/4:10,0:10/4:10);
Expand Down

0 comments on commit 1c8de35

Please sign in to comment.