Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Adding second half
  • Loading branch information
sed12008 committed May 1, 2017
1 parent d6bb103 commit 63d9c85
Show file tree
Hide file tree
Showing 6 changed files with 129 additions and 0 deletions.
23 changes: 23 additions & 0 deletions PlotSSS.m
@@ -0,0 +1,23 @@
function PlotSSS(maxLoad)
%Generates deflections based on all values of distributed load from 1 to
%inputted value maxLoad, plots output of deflection against load

%Given physical parameters
q = [1:maxLoad]; %initialize array of loads for plotting
w = zeros(1,maxLoad); %initialize array of deflections for plotting
x = 0.5; %location of maximum deflection (constant for all q)

%Iterate function for all values of q
for n = 1:maxLoad
%Place max deflections in an array w
w(n) = -shape_simple_support(x,n);
end

%Plotting routine
plot(q,w)
setdefaults
xlabel('Applied Load (N/m)')
ylabel('Max Deflection (m)')
title('Applied Load versus Maximum Deflection')
end

20 changes: 20 additions & 0 deletions plotCDM_Part_2.m
@@ -0,0 +1,20 @@
%Problem 2a-d
clear;
clc;

%iterates through each number of segments and applied load to fin three
%vectors of values of deflection for each load
N = [6,10,20];
q = [1,10,20,30,50];
data = zeros(3,5);
for n = [1:3]
for m =[1:5]
data(n,m) = max(CDM(q(m),N(n),0));
end
end

%Plotting routine for Part 2
plot(q,data(1,:),q,data(2,:),q,data(3,:));
ylabel('Deflection (meters)')
xlabel('Applied Load q (N/m)')
title('Deflection vs. Applied Load q')
48 changes: 48 additions & 0 deletions plotCDM_Part_3.m
@@ -0,0 +1,48 @@
N = [6,10,20];
q = [1,10,20,30,50];
P = [0,100,200,300];

for n = [1:4]
for m =[1:5]
data_6(n,m) = max(CDM(q(m),6,P(n)));
end
end
subplot(1,3,1)
plot(q,data_6(1,:),q,data_6(2,:),q,data_6(3,:),q,data_6(4,:));
%Plotting q vs. x_distance_vector
ylabel('Deflection (meters)')
%sets proper bounds for x axis
xlabel('Applied Load q (N/m)')
%set Proper bounds for y axis
title('Deflection vs. Applied Load q (6 Segments)')
%Title of the graph.

for n = [1:4]
for m =[1:5]
data_10(n,m) = max(CDM(q(m),10,P(n)));
end
end
subplot(1,3,2)
plot(q,data_10(1,:),q,data_10(2,:),q,data_10(3,:),q,data_10(4,:));
%Plotting q vs. x_distance_vector
ylabel('Deflection (meters)')
%sets proper bounds for x axis
xlabel('Applied Load q (N/m)')
%set Proper bounds for y axis
title('Deflection vs. Applied Load q (10 Segments)')
%Title of the graph.

for n = [1:4]
for m =[1:5]
data_12(n,m) = max(CDM(q(m),12,P(n)));
end
end
subplot(1,3,3)
plot(q,data_12(1,:),q,data_12(2,:),q,data_12(3,:),q,data_12(4,:));
%Plotting q vs. x_distance_vector
ylabel('Deflection (meters)')
%sets proper bounds for x axis
xlabel('Applied Load q (N/m)')
%set Proper bounds for y axis
title('Deflection vs. Applied Load q (12 Segments)')
%Title of the graph.
3 changes: 3 additions & 0 deletions setdefaults.m
@@ -0,0 +1,3 @@
set(0,'defaultAxesFontSize',16)
set(0,'defaultTextFontSize',14)
set(0,'defaultLineLineWidth',3)
17 changes: 17 additions & 0 deletions shape_simple_support.m
@@ -0,0 +1,17 @@
function w = shape_simple_support(x,q)
%Takes input of x (position) and q (applied distributed load)
%and calculates the deflection of the beam at a point

%Given physical parameters
E = 70*10^9; %Pa - elastic modulus
l = 1; %m - beam length
b = 0.1; %m - beam width
h = 0.01; %m - beam height

%Derived variables
I = (b*(h^3))/12; %m^4 - moment of inertia

%Deflection calculated at x (in meters)
w = (((q*l*(x^3))/(12*E*I)))-(((q*(x^4))/(24*E*I)))-((q*(l^3)*x)/(24*E*I));
end

18 changes: 18 additions & 0 deletions solveODE.m
@@ -0,0 +1,18 @@
%Initialize Constants
E = 70*10^9; %Pa
dens = 2700; %kg/m^3
b = 0.1; %m
h = 0.01; %m
l = 1; %m

%Derived variables
I = (b*(h^3))/12; % m^4
area = b*h; %m^2

[x,w] = ode45(@defl,[0 1],[0;0.001;0;-0.1]);
plot(x,w(:,1),'-o',x,w(:,2),'-o')
title('Depiction of Beam Deflection with ODE45');
xlabel('Position x (m)');
ylim([-0.001 0.001])
xlim([0 1])
ylabel('Deflection (m)');

0 comments on commit 63d9c85

Please sign in to comment.