Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Final_Project/central_difference_10P.m
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
24 lines (23 sloc)
902 Bytes
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
function central_difference_10P(P,q) | |
%This function solves the system of equations for the beam when P>0 | |
%It takes an input load P and q and determines the deflection for a 10 | |
%segment beam | |
b=0.1; | |
h=0.01; | |
I=(b*(h^3))/12; | |
E=70E9; | |
n=10; | |
%above numbes are variables for important constants | |
delta=1/n; | |
z=((delta.^4)*q)/(E*I); | |
OD=-4-(((P*(1/(n^2)))/(E*I)));%finds off diagonal term | |
D=6+((P*(2*(1/(n^2))))/(E*I));%finds diagonal Term | |
OffDiagVect=ones((n-2),1)*OD;%Creates the off diagonal vector | |
DiagVect=ones(n-1,1)*D;%Creates the diagonal vector | |
Off_Off_Diag=ones((n-3),1);%Creates the Off-Off diagonal Vector | |
A=diag(OffDiagVect,-1)+ diag(DiagVect)+diag(OffDiagVect,1)+diag(Off_Off_Diag,2)+diag(Off_Off_Diag,-2); | |
A(1,1)=5+((P*(2*(1/(n^2))))/(E*I));%forms Matrix A | |
A((n-1),(n-1))=5+((P*(2*(1/(n^2))))/(E*I)); | |
B=[z;z;z;z;z;z;z;z;z];%forms Matrix B | |
W=A\B%Solves for the deflection | |
end |