Skip to content Skip to sidebar Skip to footer

Beamdeflection Plot

I'm having trouble with my script not showing a plot. The plot must show the deflection of the beam as a function of the x-coordinate of the entire beam. I don't know if I can mak

Solution 1:

Your array x is created with a list of integers from range(0,l), which means that the elements in the array are of type int. You create the y array using np.epty_like() which means that it also has elements of type int. Unless you are using huge values for the loads, the float values created by your calculations get rounded to 0 when converted to int, so the plot is a flat line at y=0.

You can fix this by specifying that y should contain float values when it is created by adding dtype=float to:

y=np.empty_like(x, dtype=float)

You should also remove the plt.ylim(0,10000) and instead let matplotlib autoscale your y-axis, since the displacements are probably not going to be this large for any reasonable values of loads (given your stiffness)

Post a Comment for "Beamdeflection Plot"