Skip to content

Commit

Permalink
SE_diff (Chris)
Browse files Browse the repository at this point in the history
  • Loading branch information
cjc13016 committed Dec 11, 2017
1 parent 96d48b1 commit 8354c38
Showing 1 changed file with 91 additions and 0 deletions.
91 changes: 91 additions & 0 deletions SE_diff.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
function [pw_se,w]=SE_diff(T,P,n)
w = membrane_solution31(T,P,n);
A = zeros(n,n);
h = zeros(n,1);
m = n+1; %Represents the number of nodes

%Top Left Corner Interior Node
for i = 2+m
A(i,i)=1;
A(i,i-1)=0;
A(i,i+m)=1;
A(i,i+m-1)=0;
h(i) = 10;
end
%Top Right Corner Interior Node
for i = m*2-1
A(i,i)=1;
A(i,i-1)=1;
A(i,i+m)=1;
A(i,i+m-1)=1;
h(i) = 10;
end
%Bottom Left Corner Interior Node
for i = m*m-(2*m)+1
A(i,i)=1;
A(i,i-1)=0;
A(i,i+m)=0;
A(i,i+m-1)=0;
h(i) = 10;
end
%Bottom Right Corner Interior Node
for i = (m*m)-m-1
A(i,i)=1;
A(i,i-1)=1;
A(i,i+m)=0;
A(i,i+m-1)=0;
h(i) = 10;
end

%The following represent the values for the interior nodes

%Top Interior Row
for i = 3+m:m*2-2
A(i,i)=1;
A(i,i-1)=1;
A(i,i+m)=1;
A(i,i+m-1)=1;
h(i) = 10;
end
%Bottom Interior Row
for i = m*m-(2*m)+2:(m*m)-m-2
A(i,i)=1;
A(i,i-1)=1;
A(i,i+m)=0;
A(i,i+m-1)=0;
h(i) = 10;
end
%Left Interior Column
for i = (2*m)+2,(2*m)+2:(m*m)-(2*m)+2
A(i,i)=1;
A(i,i-1)=0;
A(i,i+m)=1;
A(i,i+m-1)=0;
h(i) = 10;
end
%Right Interior Column
for i = (3*m)-1,(2*m)+2:(m*m)-(2*m)+2
A(i,i)=1;
A(i,i-1)=1;
A(i,i+m)=1;
A(i,i+m-1)=1;
h(i) = 10;
end
%Inerior Nodes
for i = (2*m)+3:(3*m)-2,(2*m)+3:(m*m)-(3*m)+3
A(i,i)=1;
A(i,i-1)=1;
A(i,i+m)=1;
A(i,i+m-1)=1;
h(i) = 10;
end


dw_dx = (A(i,i)-A(i-1)+A(i,i+m)-A(i,i+m-1))/(2.*h);
dw_dx'

end




0 comments on commit 8354c38

Please sign in to comment.