Displacement of cantilevered beam matlab

Join the discussion
Registration is free. Start your own thread to ask a follow-up.
3 replies · 4K views
DODGEVIPER13
Messages
668
Reaction score
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?
 

Attachments

  • Capture.PNG
    Capture.PNG
    14 KB · Views: 929
Physics news on Phys.org
For one thing, E = 30 Mpsi = 30 * 10^6 psi, or 30,000,000 psi. This accounts for the discrepancy in the deflection calculation. It doesn't explain why to slope wasn't output.
 
>> displacement(30*10.^6,0.163,10,3,1000) ok this is what I entered and I still didn't get a plot any more hints?
 
hey appreciate the help man I got it figure out