%Mason Averill %ME-480 Fall 2020, 11/20 %Optimizer %%______________________________________________________________________ %input parameters l=1; %length of the beam in meters t=0.05; %width of the beam in meters e=200*10^9; %Young's Modulus of the steel utilized in Pa density=7900; %density of the steel utilized in kg/m^3 gravity=9.81; %acceleration due to gravity Wmax=200; %maximum weight of beam in N p=5000; %Point load applied at end of beam in N number_of_elements=100; %specify number of elements to consider step_size_const_solve=0.0001; delta_x=l/number_of_elements; x=0:delta_x:l; %First lets find the deflection for a constant cross section beam hmax=Wmax/(density*gravity*t*l); %maximum height permissible to still meet max weight criteria deflection_constant=(p*l^3)/(3*e*t*(1/12)*hmax^3); %deflection for the constant cross-section beam %_______________________________________________________________________________________________________________ %Now lets find the ideal linear case syms x1 m b h_x_linear=m*x1+b; %general equation for linear h(x) int_h_x_linear=vpa(int(h_x_linear,x1,[0 l])); %integrating h(x) symbolically from 0 to l m=solve(int_h_x_linear==Wmax/(density*gravity*t),m); %setting the integral from 0 to l for h(x) equal to the max weight to eliminate one coefficient h_x_linear=m*x1+b;%now have a function h(x) of only one unknown coefficient b %find deflection in terms of b deflection_linear=(12*p/(e*t))*vpaintegral((x1^2/h_x_linear^3),x1,[0 l]); %this is the deflection of the beam at the free end in terms of b height_max=0.023; %set an upper bound for the unknown coefficient b_value=0.018; %initialize b value variable deflection_b=[]; i=1; b_store=[]; while(b_value