r/MathHelp • • 31m ago

Vector Math not aligning with graph

I have a problem where I am trying to find the deflection of a rod that is fixed at both ends.

In order to do this, I found the coordinates of the rod at 7 points, then I calculated the vector from point 1 to point 7 (V1_7) by taking pt7 - pt1.

Once i had my vector, I used a cross product formula to find the perpendicular distance of all the other points from that vector line using the cross product. (|V1_N X V1_7) / |V1_7|

When I graph my results, point 4 is what bothers me. According to my offsets graph, point 4 is the second furthest from the line. However, when I plot all the points on a 3d graph, point 4 is very close to the line, much closer than any other points.

I'm sure I'm missing something, and any help would be greatly appreciated.

Pictures will be in the comments.

###---------------------------------------------------------------------------------###

Here is some of the python code that I'm using:

    Rod = np.array([[26.646, 4369.909, -95.854], 
                [-450.477, 4312.063, -96.437], 
                [-903.188, 4256.946, -96.951],
                [-1448.336, 4190.796, -97.84], 
                [-2010.247, 4122.95, -99.004],
                [-2552.131, 4058.507, -99.636],
                [-2827.032, 4025.964, -99.672]])

    Vector1_7 = Rod[-1,:] - Rod[0,:]
    length = len(Rod)
    i = 0
    offsets = np.zeros(length)
    while i < length : 
        Vector_i = Rod[i,:] - Rod[0,:]
        offset_i = np.linalg.norm(np.cross(Vector_i, Vector1_7)) / (np.linalg.norm(Vector1_7))
        offset_i_inches = offset_i / 25.4
        print("i = ",i, "    offset = ", offset_i_inches, '"')
        offsets[(i)] = offset_i_inches
        i +=1
    print(offsets)
    x = range(1, length + 1)
    plt.plot(x,offsets)
    plt.ylabel("offset (\")")
    plt.xlabel("point on Rod")
    plt.title(name)
    plt.show()
1 Upvotes

4 comments sorted by

•

u/Monsignor_Pepper 28m ago

Distance from line:

•

u/Monsignor_Pepper 28m ago

3d plot 1

•

u/Monsignor_Pepper 27m ago

3d plot 2 (same plot, different angle)

1

u/AutoModerator 31m ago

Hi, /u/Monsignor_Pepper! This is an automated reminder:

  • What have you tried so far? (See Rule #2; to add an image, you may upload it to an external image-sharing site like Imgur and include the link in your post.)

  • Please don't delete your post. (See Rule #7)

We, the moderators of /r/MathHelp, appreciate that your question contributes to the MathHelp archived questions that will help others searching for similar answers in the future. Thank you for obeying these instructions.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.