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?
me3255_finalproject_group29/montecarlo.m
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
32 lines (31 sloc)
857 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
% This script uses a Mote Carlo model to determine mean and standard | |
% deviation for the maximum deflection if b and h are normally distributed | |
% random variables with 0.1% standard deviation at q = 50 N/m | |
clear | |
clc | |
% Length of the beam [meters]: | |
L = 1; | |
% Prescribed distributed loading: | |
q = 50; | |
% Young's Modulus for aluminum [Pascals]: | |
E = 70e9; | |
% x_max is the maximum deflection | |
x_max = 0.5; | |
% Width of beam [meters]: | |
b = 0.1; | |
% Height of beam [meters]: | |
h = 0.01; | |
% Standard deviation is 0.1%: | |
stdev = 0.1; | |
% Number of iterations: | |
N = 50; | |
for i = 1:N | |
b_mont = normrnd(b,stdev*b); | |
h_mont = normrnd(h,stdev*h); | |
I = (b_mont*h_mont^3)/12; | |
% Derived equation for vertical deflection: | |
w = (q/(24*E*I)).*x_max.^4 - ((q*L)/(12*E*I)).*x_max.^3 + ((q*L^3)/(24*E*I)).*x_max; | |
w_mont(i) = w; | |
end | |
mean = mean(w_mont); | |
stand_dev = std(w_mont); |