Back

Explore Courses Blog Tutorials Interview Questions
0 votes
3 views
in Python by (120 points)
line 95: LIb = np.empty(int(xlist))
c = np.linspace(0.01, 1, 100)
for ratio_beams in c:
    s = 1
    xlist = np.linspace(3, 16, 14)
    ylist = np.linspace(0.01, 1, 100)
    n, ratio_shear = np.meshgrid(xlist, ylist)
    theta = 60

    b = ratio_shear / (2 * s)
    d_s = (2 * b * s)
    a = b / (np.sin(np.radians(theta)))
    d_b = 2 * ratio_beams * s
    alpha = 360 / n

    r = s/(2*(np.sin((np.pi/n))))
    apothem = s / (2 * np.tan(np.radians(180 / n)))

    AreaFil = n * (0.25 * np.pi * (d_b ** 2))
    AreaElli = (np.pi * a * b) * n

    Dc = s * (1 / np.sin((np.pi / n))) + d_b
    t = np.sqrt((AreaFil + AreaElli) / 4)

    Ic = ((np.pi) / 64) * ((Dc ** 4) - ((Dc - 2 * t) ** 4))


    LIb = np.empty(int(xlist))
    LIs = np.empty(int(xlist))

    for i in xlist:
        for i in range(1, (xlist+1)):
            if (n % 2) == 0:
                LIb[i-1] = abs(r * np.cos(np.radians((alpha / 2)) + (i - 1) * (np.radians(alpha))))
            else:
                LIb[i-1] = abs(r * np.cos(np.radians((i - 1) * (np.radians(alpha)))))

            if (n % 2) == 0:
                LIs[i-1] = abs(apothem * np.cos(np.radians((i - 1) * (np.radians(alpha)))))
            else:
                LIs[i-1] = abs(apothem * np.cos(np.radians((alpha / 2)) + (i - 1) * (np.radians(alpha))))

        LIbSum = np.sum((LIb**2))
        LIsSum = np.sum((LIs**2))

    I1 = (np.pi * (d_b ** 4)) / 64
    I2 = ((AreaFil / n) * (LIbSum))
    I3 = ((np.pi / 4) * (a ** 2) * (b ** 2))
    I4 = ((AreaElli / n) * (LIsSum))

    Iz = I1 + I2 + I3 + I4

    I_Ratio = (Iz / Ic)

    for idx in range(int(ratio_beams)): 
        X = n #xlist
        Y = ratio_shear #ylist
        Z = I_Ratio #height, Iz/Ic
        plt.contour(X, Y, Z)
        plt.savefig(str(idx))

Please log in or register to answer this question.

Browse Categories

...