Python图形困难

时间:2015-04-05 18:58:40

标签: python graph

这是我目前正在运行的脚本;没有错误,但结果应该是一个循环图,而不是我得到的半圆 - 任何帮助都表示赞赏!

import math
import numpy as np
import matplotlib.pyplot as plt
%pylab inline

# max = maximum principal stress
# min = minimum principal stress
# x_norm = normal stress in x-direction
# y_norm = normal stress in y-direction
# t = shear stress

x_norm = -60
y_norm = 50
t = 50

R = math.sqrt(((x_norm - y_norm)/2)**2 + t**2)
print 'The radius of the circle is         '+str(R)

max = int((x_norm + y_norm)/2 + R)
min = int((x_norm + y_norm)/2 - R)
print 'The maximum stress is               ' +str(max)
print 'The minimum stress is              ' +str(min)

theta = 0.5 * math.atan((2*t)/(x_norm - y_norm))
print 'The angle rotation of the block is ' +str(theta)

aver = (x_norm + y_norm)/2
print 'The average shear stress is        ' +str(aver)

x = np.linspace(min, max, 1000)
y = np.sqrt((R**2) - ((x-aver)**2))

plt.axis([-100, 100, -100, 100])

plt.plot(x,y)
plt.show()

0 个答案:

没有答案