Question: Please write my matlab code for CEE 2 2 1 9 B MATLAB exercise Consider sectioning your code. Debug your code! Add comments. Question 1

Please write my matlab code for CEE 2219B
MATLAB exercise Consider sectioning your code. Debug your
code! Add comments.
Question 1: Suppose we have a supported beam with a uniformly distributed load. The deflection (y) of the beam at any point x along its length can be approximated by the following equation:
y(x)= W0/120EIL(-5x^2=2L^2x^3-L^4x)
Where W0 is the uniformly distributed load (force per unit length), E is Youngs modulus of
the material, I is the moment of inertia of the beams cross-sectional area, L is the length of the
beam, and x is the distance along the beam.
PART A:
Write a MATLAB function to calculate the deflection for value(s) of x. Input in the code W0=2.5 KN/cm, E=50,000 KN/cm^2, I=30,000 cm^4, and L=600 cm. Enable the code to:
calculate the deflection
determine the maximum deflection and maximum deflection locations using MATLABs
built-in function min. The min function in MATLAB returns the minimum value and
the index where that minimum value occurs in the input vector (for more information help
min command).
syntax: [min_value, index]=min(variable name of the array containing all values)
Note that deflection values are negative numbers, and the max deflection =min value.
use the index (from the above output) to identify the location of maximum deflection of
vector x.
Example vector x contains 5 data points, then write a code to find the data that is stored in
row 2(in this case index=2)
x=[2,3,5,7,9]; then x(2)=3
plot the deflection y(x) along the length of the beam
mark the point of maximum deflection on the plot
PART B:
Call the function you build in a, and evaluate the function for x values ranging from 0 to L
with a step size 10.
Publish the code in a, the function call in b and the corresponding outputs. The code should
provide an array of deflection, an array of maximum deflection, an array of locations of
maximum deflection, a plot of y vs x and a mark showing the point of maximum deflection on
the plot.
Hint:
Use MATLABs plot function to mark the point of max deflection (use maximum
deflection value and location as inputs)
Consider adding deflection, maximum deflection and location of maximum deflection
as the function output variables.
Question 2
PART A:
In this case, modify the Matlab function you built-in question one and enable it to work for
any deflection equation (function), any value of x and any value of the constants (L, E, I, L
and W0). Save this function using a different file name.
PART B:
Call your newly built deflection function and calculate the deflection, maximum deflection and
point of maximum deflection of the below uniformly distributed load
y(x)=-W0/48EI(2x^4-3Lx^3+L^3x)
L =300 cm, E =52,000 kN/ cm^2, I =32,000 cm^4, W0=4 KN/cm, and x values range from 0 to L with a step size of 10.
Note that:
Functions can be called either in a command window or by creating a new script file
See lecture 8 for reference on how to pass a function as an input (anonymous function)
Please write all these codes.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Civil Engineering Questions!