- #1

DODGEVIPER13

- 672

- 0

## Homework Statement

Write a Matlab function to plot the displacement of a cantilevered beam under a point load. Annotate the figure’s axes and title the figure. In addition to creating the plot, the function should report (in the figure’s title!) the maximum deflection and angle between the horizontal and the surface of the beam at its tip. The geometry of the beam is shown below:

The formulas for the displacement y and tip angle θ are

y=-((Wx^2)/6EI)(3a-x) for 0<X<a

y=-((Wa^2)/6EI)(3x-a) for a<x<L

theta=0.5*((Wa^2)/EI)

where W is the point load, E is the Young’s modulus for the beam, I is the moment of inertia for the beam, and L is the length of the beam. Test your function with E = 30 Mpsi, I = 0.163 in4, L = 10 in, a = 3 in, W = 1,000 lbf. Report both your code and the plot for the given values.

## Homework Equations

## The Attempt at a Solution

function[ymax,theta]=displacement(E,I,L,a,W)

for x=linspace(0,a);

y=-(W*x.^2*(3*a-x))/(6*E*I);

end

for x=linspace(a,L);

y=-(W*a.^2*(3*x-a))/(6*E*I);

end

theta=0.5*((W*a.^2)/(E*I));

plot(y,x);

xlabel('Pos');

ylabel('disp');

title(sprintf('ymax=%g, theta=%5.3f',ymax,theta));

This is what I get:

ans =

8.2822e+003

The plot shows nothing so I am confused, what should I do?