help plotting basic x vs y?

69 views (last 30 days)
Raphael Hatami
Raphael Hatami on 20 Sep 2019
Commented: Raphael Hatami on 20 Sep 2019
Hello, I am trying to plot x and y from x = 0 to x=L. Right now it goes haywire and plots a bunch of vertical lines which is not correct. Can someone tell me how to fix this? Thank you.
%constants
w0 =2.5 %kN/cm
L = 600 %cm
I = 30000 %cm^4
E = 50000; %kN/cm^2
%equation
y = @(x) w0./(120*E*I*L)*(-5*x^4+6*L^2*x^2-L^4);
x =linspace(0,L,100);
fplot(x,y)
ylabel('Displacement [cm]')
xlabel('Location [cm]')
title('Max Deflection at x = 531.2241cm')

Accepted Answer

David Hill
David Hill on 20 Sep 2019
x =linspace(0,L,100);
y =w0./(120*E*I*L)*(-5*x.^4+6*L^2*x.^2-L^4);
plot(x,y);

More Answers (0)

Categories

Find more on Animation in Help Center and File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!